http://api.t.sina.com.cn/short_url/shorten.json?source=826420361&url_long=https://www.dcqzz.cn
http://sa.sogou.com/gettiny?url=https://www.dcqzz.cn
http://sa.sogou.com/gettiny?url=http%3a%2f%2fd1h.net&apptype=sogousearch&rt=dev_video
http://sa.sogou.com/gettiny?url=http://d1h.net&apptype=sogousearch&rt=smallvideo
(图片随便配的)
url.cn是腾讯微博的短网址,但是有没有开放未知,于是抓包分析,最后得到了接口.
请求地址: http://openmobile.qq.com/api/url_change请求参数:(支持多个url,需要urlencode)
type=1&mType=qb_share&value=%5b"你要缩短的网址"%5d请求参数实例:
type=1&mType=qb_share&value=%5b"http%3A%2F%2Fwww.awobaba.cn","http%3A%2F%2Fawobaba.cn"%5d主要的是需要带上cookies,只需要带上两个参数便可
skey=f3fe8fa02a69509d6877be0a9120413d
skey=
uin=o00你的QQ
例如:
uin=o0023360598
if( isset($_GET['url']) ){
$wx = $_GET['url']; }
else{$wx = 'http://res.wx.qq.com/open/zh_CN/htmledition/openwap/images/icon_link1f8935.png';}
$wx = $_GET['url'];
if(empty($wx))
{$wx = 'http://res.wx.qq.com/open/zh_CN/htmledition/openwap/images/icon_link1f8935.png';}
$wxurl=urlencode("".$wx);
//echo $wx;
//$api = 'http://sa.sogou.com/gettiny?url='.$wxurl;
//多个链接
//$api = 'https://openmobile.qq.com/api/url_change?type=1&mType=qb_share&value=%5b"http%3A%2F%2Fwww.awobaba.cn","http%3A%2F%2Fawobaba.cn"%5d'.$wxurl;
$api = 'https://openmobile.qq.com/api/url_change?type=1&mType=qb_share&value=%5b"'.$wxurl.'"%5d';
$headers = array();
$headers[] = 'Host: openmobile.qq.com';
$headers[] = 'Host: Content-Type:application/x-www-form-urlencoded';
$headers[] = 'User-Agent: QQ/8.1.8.429 CFNetwork/978.0.7 Darwin/18.5.0';
$headers[] = 'Referer:http://openmobile.qq.com/';
//$headers[] = 'cookie: skey=MlyPJnrd7b; uin=o0442052039';
$headers[] = 'cookie: skey=M6nmsivJot; uin=o0820192113;';
//抓https://cdn.ark.qq.com/arkapp/app_config.json
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
$str = curl_exec($ch);
curl_close($ch);
//$arr = json_decode($str, true);
//$strr=$arr['ae_url'];
//$strr=str_ireplace(['http://','gb23122222222'],['https://','utf-8888888888'],$strr);
//判断url.cn
$err="https://url.cn/404";
if(strpos(''.$str,'url.cn') !==false){
//有url.cn则执行下面
//echo $str;
//php---json
$arr = json_decode($str, true);
/////json///{"retcode":0,"msg":"ok","result":{"list":["http://url.cn/5Q7nhGN"]}}
http://url.cn/5Q7nhGN
$strr=$arr['result']['list'][0];
echo $strr;}
else{//没有
echo $err;}
?>