使用以下方法在常规链接上提取链接似乎很简单:
$link = $('a:eq(1)');
var real_link = $link.attr('href');
最难的部分是如何从加密链接中提取链接,如下所示: https://jsfiddle.net/rm7mp8do/
如果您将鼠标悬停在链接上,则在状态栏上会显示虚假链接,如:
hxxp:// this_is_fake_link
但点击它后,它会带您进入原始链接:
hxxp://mg.com/ghits/xxx/xxx/xxx/xxx/x/x/ H = gdwagdjgawjhvjwhafgdjhwavwxdjhav
答案 0 :(得分:-1)
您可以使用curl return transfer ...
尝试这个PHP脚本function expand_short_url($url)
{
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,false);
$header = curl_exec($ch);
$fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header)); // Parse information
for($i=0;$i<count($fields);$i++)
{
if(strpos($fields[$i],'Location') !== false)
{
$url = str_replace("Location: ","",$fields[$i]);
}
}
return $url;
}