21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
function ToReturl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$ret = curl_exec($ch);
$info = curl_getinfo($ch);
$retURL = $info['url'];
curl_close($ch);
return $retURL;
}
$url="https://m.tb.cn/h.3IwzNhD?sm=3c4e43";
echo ToReturl($url);
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no, email=no">
<title></title>
<script src="//g.alicdn.com/mtb/lib-callapp/1.4.8/??combo.js,callapp.js"></script>
<style>
body{
background-repeat:no-repeat;
background-position: left top;
background-color: #efeff4;
background-size: 100%;
padding: 0;
margin: 0;
}
</style>
<script>
//业务点code
var bizCode="tbshare";
//短地址
var shortName = "h.3IwzNhD";
//目标地址
var url = 'https://a.m.taobao.com/i571076654343.htm?sourceType=item&ttid=600000@taobao_android_8.3.10&ut_sk=1.AJ2zQdCLz%2F4DANBd23CwT5P5_21646297_1547104878872.GoodsTitleURL.1&un=7a802aeb5ebe92442040bd82ddc2e1ea&share_crt_v=1&sp_tk=77+lMnhSb2JxdXVORGLvv6U=&cpp=1&shareurl=true&spm=a313p.22.29l.1003308806037&short_name=h.3IwzNhD';
//短地址有问题时跳转的地址
var invalidUrl = "http://m.tb.cn/scanError.htm";
//黄金令箭埋点值
var ecode="ecode.2.1";
//短地址状态
var status = "true";
//是否是阿里系APP访问
var isAliApp = "false";
//是否强制在body里插入img节点(tbshare有类似需求)
var mustImg = "true";
//客户端应用信息,见App.java定义,这些变量在页面上已经用不到了,全部在java内部判断用了
var app= "";//如果是微信,需要特殊处理
//客户端系统信息,见OS.java定义
var os = "";//访问的系统
//客户端打开的方式,见xcode里Constant.java中定义
var appMethod="replace";
//selfview的模板不用在这里输出,不然会js变量冲突
var methodString="0";
//创建码时,指定码的extraStr的json字符内容,用于自定义模板页面填坑位用
var extraData = {"title":"干洗地毯清洁剂免水洗家用强力心居客沙发清洗工具神器杀菌消毒液"};
var replacedWxBgPic = ""
</script>
</head>
<body><script>
with(document)with(body)with(insertBefore(createElement("script"),firstChild))setAttribute("exparams","category=&userid=&aplus&yunid=&&trid=0b11c94d15471671968685128e470d&asid=AQAAAADc5TdcUparfwAAAAAsKV5DFZn3sw==",id="tb-beacon-aplus",src=(location>"https"?"//g":"//g")+".alicdn.com/alilog/mlog/aplus_v2.js")
</script>
</body>
<script type="text/javascript" src="/assets/scan.js?t=201705231430"></script>
</html>
可以看到有个M站的地址 目标地址
当你访问 这个目标地址的时候人家会判断你是什么来源再看是否跳转到PC 链接
curl -I 'https://a.m.taobao.com/i571076654343.htm?sourceType=item&ttid=600000@taobao_android_8.3.10&ut_sk=1.AJ2zQdCLz%2F4DANBd23CwT5P5_21646297_1547104878872.GoodsTitleURL.1&un=7a802aeb5ebe92442040bd82ddc2e1ea&share_crt_v=1&sp_tk=77+lMnhSb2JxdXVORGLvv6U=&cpp=1&shareurl=true&spm=a313p.22.29l.1003308806037&short_name=h.3IwzNhD'
就可以获取到PC站的链接了
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Fri, 11 Jan 2019 00:46:35 GMT
Content-Type: text/html
Content-Length: 280
Connection: keep-alive
Location: http://item.taobao.com/item.htm?id=571076654343&sourceType=item&ttid=600000@taobao_android_8.3.10&ut_sk=1.AJ2zQdCLz%2F4DANBd23CwT5P5_21646297_1547104878872.GoodsTitleURL.1&un=7a802aeb5ebe92442040bd82ddc2e1ea&share_crt_v=1&sp_tk=77+lMnhSb2JxdXVORGLvv6U=&cpp=1&shareurl=true&spm=a313p.22.29l.1003308806037&short_name=h.3IwzNhD