Home  >  Article  >  Backend Development  >  比较简单的百度网盘文件直链PHP代码_php技巧

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

WBOY
WBOYOriginal
2016-05-17 09:06:221550browse

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

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

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

复制代码 代码如下:

$canshu=$_SERVER["QUERY_STRING"];
if($canshu=="")
{
die("文件不存在");
}
else
{
$wangzhi="http://pan.baidu.com/share/link?".$canshu;
$file=file_get_contents($wangzhi);
$pattern='/a>/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这样的格式
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn