天翼网盘下载速度还是可以的,去年有个活动很多人都搞了个天翼网盘的VIP会员,通过天翼网盘分享文件的人也多了,经常下载碰到使用天翼网盘分享文件的,但天翼网盘下载文件需要登陆这就有些麻烦了,小编为了方便就写了个天翼网盘下载地址解析php代码,不过需要使用浏览器获取登陆状态下的cookie值放到php代码中才可以使用,代码随意写的有些粗糙,但可以正常使用,有需要就复制下面小编分享的天翼网盘下载地址解析php代码到新建php文件中,稍作修改就可以使用了,建议获取天翼网盘登陆状态下的cookie值请在浏览器无痕模式下获取。
使用方法:http://localhost/a.php?id=3UbIJjUJfAfy&pw=1234 id为分享码 pw为密码没有就留空
<?php error_reporting(0); define('COOKIES','COOKIE_LOGIN_USER=xxxxxxx;'); $id = isset($_GET['id']) ? addslashes(trim($_GET['id'])) : 'YRfaieIzQFBv'; $pw = isset($_GET['pw']) ? addslashes(trim($_GET['pw'])) : ''; $url = 'https://cloud.189.cn/t/'.$id; $pwdat = json_decode(Curl('https://cloud.189.cn/shareFileByVerifyCode.action?accessCode='.$pw.'&shortCode='.$id)); $fileid = $pwdat->fileId; $fileurla = json_decode(Curl('https://cloud.189.cn/v2/getFileDownloadUrl.action?shortCode='.$id.'&fileId='.$fileid)); $fileurlb = Curl_info('https:'.$fileurla); header('location: '.$fileurlb);exit(); function Curl($url){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_REFERER, $url); curl_setopt($curl, CURLOPT_COOKIE, COOKIES); $data = curl_exec($curl); curl_close($curl); return $data; } function Curl_info($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_COOKIE, COOKIES); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_exec($ch); $info = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);//www.8gws.com curl_close($ch); return $info; }