比较简单的百度网盘文件直链PHP代码

yipeiwu_com6年前PHP代码库

百度网盘速度快,稳定性好,你值得拥有,如果以后支持直连以后就可以直接使用百度的网盘了。

这里提供的是临时解决方案,不保证以后可以使用

将下面的代码保存为downbd.php

复制代码 代码如下:

<?php
$canshu=$_SERVER["QUERY_STRING"];
if($canshu=="")
{
die("文件不存在");
}
else
{
$wangzhi="http://pan.baidu.com/share/link?".$canshu;
$file=file_get_contents($wangzhi);
$pattern='/a><a class="dbtn cancel singledbtn" href=(.*?)id="downFileButtom">/i';
preg_match_all($pattern,$file,$result);
$tempurl=implode("",$result[1]);
$fileurlt=str_replace("\"","",$tempurl);
$fileurl=str_replace("&","&",$fileurlt);
header("location:$fileurl");
}
?>


调用方法:

http://***/downbd.php?shareid=00000&uk=00000
主要是?shareid=00000&uk=00000这样的格式

相关文章

深入PHP内存相关的功能特性详解

可能有的读者碰到过类似下面的错误吧:Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y...

php使用curl模拟多线程实现批处理功能示例

本文实例讲述了php使用curl模拟多线程实现批处理功能。分享给大家供大家参考,具体如下: php模拟多线程用到curl库,这个库很强大,可以做好多事,比如模拟登陆,文件上传/下载,数据...

php 判断访客是否为搜索引擎蜘蛛的函数代码

复制代码 代码如下: /** * 判断是否为搜索引擎蜘蛛 * * @author Eddy * @return bool */ function isCrawler() { $agent...

基于php的CMS中展示文章类实例分析

本文实例讲述了基于php的CMS中展示文章类。分享给大家供大家参考。具体分析如下: <?php /***********************************...

PHP abstract 抽象类定义与用法示例

本文实例讲述了PHP abstract 抽象类定义与用法。分享给大家供大家参考,具体如下: PHP抽象类应用要点: 1.定义一些方法,子类必须完全实现这个抽象中所有的方法 2.不能从抽...