Home  >  Article  >  Backend Development  >  Relatively simple Baidu Netdisk file direct link PHP code_PHP tutorial

Relatively simple Baidu Netdisk file direct link PHP code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:12:26956browse

Baidu network disk is fast and stable. You deserve it. If direct connection is supported in the future, you can directly use Baidu network disk.

The solution provided here is a temporary solution and is not guaranteed to work in the future

Save the following code as downbd.php

Copy the code The code is as follows:

$canshu=$_SERVER["QUERY_STRING"];
if($canshu=="")
{
die("File does not exist");
}
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");
}
?>


Calling method:

http://***/downbd.php?shareid=00000&uk=00000
Mainly?shareid=00000&uk=00000 This format

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326719.htmlTechArticleBaidu Netdisk is fast and stable. You deserve it. If it supports direct connection in the future, you can use it directly. Baidu’s network disk. The solutions provided here are temporary solutions and are not guaranteed in the future...