全球主机交流论坛
标题:
有没有短域名还原解析的源码?
[打印本页]
作者:
sohu
时间:
2018-12-7 11:15
标题:
有没有短域名还原解析的源码?
就是把短域名转成真实地址的源码?
作者:
sohu
时间:
2018-12-7 11:36
这个没有开源的吗?
作者:
勇气
时间:
2018-12-7 11:39
http://www.wheregoes.com/
这个可以还原,但是没找到源码
作者:
coobar
时间:
2018-12-7 11:41
https://duanwangzhihuanyuan.51240.com/
这里还原
作者:
sohu
时间:
2018-12-7 15:35
要源码呀,有没有
作者:
flofire
时间:
2018-12-7 16:02
<?php
function restoreSinaShortUrl($shortUrl = '')
{
$url = "https://api.weibo.com/2/short_url/expand.json?source=2815391962&url_short={$shortUrl}";
$urlInfo = file_get_contents($url);
if ($urlInfo){
$urlInfo = json_decode($urlInfo, true);
if (!json_last_error() && isset($urlInfo['urls'])){
return $urlInfo['urls'][0]['url_long'];
}
}
return false;
}
//还原短链接
//http://t.cn/zWCJpzQ
function getRealUrl($url)
{
while(true){
if (strstr($url, 'http://t.cn/')){
$url = restoreSinaShortUrl($url);
} else {
break;
}
}
return $url;
}
复制代码
作者:
sohu
时间:
2018-12-7 18:00
flofire 发表于 2018-12-7 16:02
这只有一种后缀?想找个成品的开源,直接放上去用那种
作者:
虚拟
时间:
2018-12-7 18:07
用PHP 去模拟跑一下网址,在把网址显示出来..
欢迎光临 全球主机交流论坛 (https://loc.mjj8.eu.org/)
Powered by Discuz! X3.4