PHP百度网盘直链函数
程序员文章站
2024-01-25 18:12:58
...
百度网盘直链函数
http://pan.baidu.com/share/link?shareid=401091&uk=3691445095
百度网盘直链函数
http://pan.baidu.com/share/link?shareid=401091&uk=3691445095
百度网盘直链函数
function baiduPanUrl($panUrl) {
$opts = array (
'http' => array (
'method' => "GET",
'timeout' => 5
)
);
$context = stream_context_create ( $opts );
$html = file_get_contents ( $panUrl, false, $context );
$pattern = '/' . preg_quote ( 'http://www.baidupcs.com/file/', '/' ) . '(.*?)' . preg_quote ( '"', '/' ) . '/i';
preg_match_all ( $pattern, $html, $result );
$url = $result [1] [0];
$url = str_replace ( '&', '&', $url );
return 'http://www.baidupcs.com/file/' . $url;
}
echo baiduPanUrl('http://pan.baidu.com/share/link?shareid=401091&uk=3691445095');
AD:真正免费,域名+虚机+企业邮箱=0元
上一篇: 基于PHP生成简单的验证码_php实例
下一篇: 求解乱码难题解决方案