[PHP] 纯文本查看 复制代码
<?php
//调用接口:http://localhost/index.php?url=https://xxx.lanzout.com/xxxxxxxx&p=xxxx
//更新时间:2022-02-20 02:42:08
header("Content-Type: text/html;charset=utf-8");
//网页访问
function MloocCurl($url, $method, $ifurl, $post_data)
{
//设置ua
$UserAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36';
//初始化cURl
$curl = curl_init();
//设置cUrl传输选项
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;
}
//文本_取出中间文本
function getSubstr($str, $leftStr, $rightStr)
{
$left = strpos($str, $leftStr);
$right = strpos($str, $rightStr, $left);
if ($left < 0 or $right < $left) return '';
return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr));
}
if (!empty($_GET['url'])) {
$url = @$_GET['url'];
$p = @$_GET['p'];
//取出蓝奏云域名
preg_match("/^(.*:\/\/)?([^\/]+)/i", $url, $link);
$domain = $link[0];
if ($p == "") {
#没有密码获取方法
#第一步,取出fn
$ruleMatchDetailInList = "~src=\"\/fn\?([\s\S]*?)\"~";
preg_match_all($ruleMatchDetailInList, MloocCurl($url, null, null, null), $link);
$fn = $link[1][1];
$ifurl = $domain . "/fn?" . $fn;
// echo $ifurl;
// echo "<br><br>";
#第二步
$data = MloocCurl($ifurl, null, null, null);
$signs = getSubstr($data, "var ajaxdata = '", "';");
$websign = getSubstr($data, "var websign = '", "';");
$websignkey = getSubstr($data, "var websignkey = '", "';");
$sign = getSubstr($data, "'sign':'", "','");
$post_data = array(
//data : { 'action':'downprocess','signs':ajaxdata,'sign':'c','ves':1,'websign':websign,'websignkey':websignkey }
"action" => "downprocess",
"signs" => $signs,
"sign" => $sign,
"ves" => "1",
"websign" => $websign,
"websignkey" => $websignkey,
);
} else {
#带密码获取方法
$ifurl = $url;
$data = MloocCurl($ifurl, null, null, null);
$sign = getSubstr($data, "action=downprocess&sign=", "&p");
$post_data = array(
//data : { 'action':'downprocess','signs':ajaxdata,'sign':'c','ves':1,'websign':websign,'websignkey':websignkey }
"action" => "downprocess",
"sign" => $sign,
"p" => $p,
);
}
$obj = json_decode(MloocCurl($domain . "/ajaxm.php", "post", $ifurl, $post_data)); #json解析
if ($obj->zt == "1") { #判断链接是否正确
$downUrl = $obj->dom . "/file/" . $obj->url;
echo $downUrl;
} else {
echo $obj->inf;
}
} else {
echo "参数错误";
echo "<br/>";
}