ua解析接⼝_蓝奏云直链解析API
源码
将以下内容命名为index.php上传到你的主机(源码收集来的)<?php
/**
* @package Lanzou
* @author Mlooc
* @version 1.0.0
*/
function MloocCurl($url,$method,$ifurl,$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';#设置ua
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if ($method == "post") {
curl_setopt($curl, CURLOPT_REFERER, $ifurl);
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['url'])) {
$url = $_GET['url'];
#第⼀步
$ruleMatchDetailInList = "~ifr2\"\sname=\"[\s\S]*?\"\ssrc=\"\/(.*?)\"~";
preg_match($ruleMatchDetailInList, MloocCurl($url,null,null,null),$link);
$ifurl = "www.lanzous/".$link[1];
#第⼆步
$ruleMatchDetailInList = "~=\s'(.*?)';[\S\s]*?=\s'(.*?)'[\S\s]*?=\s'(.*?)'[\S\s]*?=\s'(.*?)'~";
preg_match($ruleMatchDetailInList, MloocCurl($ifurl,null,null,null),$segment);
#第三步
#post提交的数据
$post_data = array(
"action" => $segment[1],
"file_id" => $segment[2],
"t" => $segment[3],
"k" => $segment[4]
);
$obj = json_decode(MloocCurl("www.lanzous/ajaxm.php","post",$ifurl,$post_data));#json解析if ($obj->dom == "") {#判断链接是否正确
echo "链接有误!";
}else{
$downUrl = $obj->dom."/file/".$obj->url;
if (!empty($_GET['type'])) {
$type = $_GET['type'];
if ($type == "down") {
header('Location:'.$downUrl);#直接下载
}else{
echo $obj->dom."/file/".$obj->url;#输出直链
}
}else{
echo $obj->dom."/file/".$obj->url;#输出直链
}
}
}else{
echo "⽰列:";
echo "
";
echo "直接下载:"."";
echo "
";
echo "输出直链:"."";
}
百度api接口>
⽤法如下
⽰例
当前页⾯是本站的「Baidu MIP」版。发表评论请点击:完整版 »

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。