Home  >  Article  >  php教程  >  PHP百度网盘直链函数

PHP百度网盘直链函数

WBOY
WBOYOriginal
2016-06-07 11:45:011562browse

百度网盘直链函数

http://pan.baidu.com/share/link?shareid=401091&uk=3691445095
百度网盘直链函数<?php <br /> function baiduPanUrl($panUrl) {<br>     $opts = array (<br>             'http' => array (<br>                     'method' => "GET",<br>                     'timeout' => 5 <br>             ) <br>     );<br>     $context = stream_context_create ( $opts );<br>     $html = file_get_contents ( $panUrl, false, $context );<br>     $pattern = '/' . preg_quote ( 'http://www.baidupcs.com/file/', '/' ) . '(.*?)' . preg_quote ( '"', '/' ) . '/i';<br>     preg_match_all ( $pattern, $html, $result );<br>     $url = $result [1] [0];<br>     $url = str_replace ( '&', '&', $url );<br>     return 'http://www.baidupcs.com/file/' . $url;<br> }<br> echo baiduPanUrl('http://pan.baidu.com/share/link?shareid=401091&uk=3691445095');

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

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