PHP提取158Pan下载直链接口

PHP接口教程 3年前 (2018) Mgo
0

说明

1.解析158Pan直链下载
2.解决158Pan烦人的下载器和各种广告
3.有能力的可以自己适当进行更改
4.转载或使用请保留版权!!!
注:提取直链下载的文件名为文件MD5,不是原文件名!!

用法

id:外链URL上面的那串数字ID
https://api.mlooc.cn/158/?id=113249

原理解释

利用curl提交POST数据包读取分享的内容json信息
解析json提取出下载直链

浏览器插件版

在浏览器上安装上此插件后打开158Pan外链地址自动弹出下载页面!

PHP提取158Pan下载直链接口

点我下载浏览器插件版

https://github.com/MHanL/158Pan--

注:转载可以但请不要改版权??尊重我的劳动成果!!!

<?php /**
 * @package 158Pan
 * @author Mlooc
 * @version 1.0.0
 * @link https://mlooc.cn
 */ // 指定允许其他域名访问  header('Access-Control-Allow-Origin:*'); function object_array($array) { if(is_object($array)) { $array = (array)$array; } if(is_array($array)) { foreach($array as $key=>$value) { $array[$key] = object_array($value); } } return $array; } function MloocCurl($post_data){ $UserAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36';#设置UserAgent $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://api.baizhu.cc/api/getinfo"); curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent); #关闭SSL curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); #返回数据不直接显示 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); $response = curl_exec($curl); curl_close($curl); return $response; } if (!empty($_GET['id'])) { $id = $_GET['id']; $post_data='js={"appid":"307","getlist":{"c1":1,"inslog":"","proc":null,"reg":[{"id":25},{"id":39},{"id":45},{"id":69},{"id":203},{"id":213}]},"id":2052,"mac":"2C-FD-A1-7B-7E-11","md5":"CF517D077E9C152120787EB6B251615B","msoft":"LG%E5%8A%A9%E6%89%8B5.8%E5%AF%86%E7%A0%81666%40307_112837.exe","rgn":"","sid":"'.$id .'","st":0,"ver":"2.2.1.207","zn":8}'; $result = json_decode(MloocCurl($post_data,true)); $result = object_array($result); $downUrl = $result["main"]["descr_downurl"]; header('Location:'.$downUrl); }else{ $result_url = str_replace("index.php","","//".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?id=113249"); echo "演示:"; echo "<br/>"; echo "<br/>"; echo '<a href="'.$result_url.'" target="_blank">'.$result_url.'</a>'; } ?>
版权声明:Mgo 发表于 2018-08-10 14:16:08。
转载请注明:PHP提取158Pan下载直链接口 | 站长聚集地

暂无评论

暂无评论...