Home > php教程 > php手册 > PHP实现《百度网盘》直连下载

PHP实现《百度网盘》直连下载

WBOY
Release: 2016-06-07 11:44:50
Original
1615 people have browsed it

最近下载thinkphp视频教程!看到了thinkphp用了一个百度网盘直连下载的功能,觉得很不错哦!利用百度强大的服务器 将自己网站的内容上传到百度,然后在自己网站直接下载,是很多站长需要的功能,特此共享。
<?php <br /> /*将本代码保存为bd.php 即可<br> <br> 利用 file_get_contents和preg_match_all、str_replace三个函数实现!<br> <br> 将百度网盘的$shareid 和 $uk 加入即可<br> 例如:http://pan.baidu.com/share/link?shareid=489412&uk=101682133<br> <br> 自己服务器上就 localhost/bd.php?shareid=489412&uk=101682133 就可以自己下载了<br> */<br> $shareid=$_GET['shareid'];<br> $uk=$_GET['uk'];<br> <br> if(isset($shareid) && isset($uk))<br> {<br> $str = file_get_contents ("http://pan.baidu.com/share/link?shareid={$shareid}&uk={$uk}");<br> <br> preg_match_all('|"dlink\\\":\\\"([^"]+)\\\",\\\"|imsU', $str, $baiduid);<br> $down=str_replace("\\","",$baiduid[1][1]);<br> <br> }<br> <br> <br> <br> header("Location: ".$down);<br> <br> ?>

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template