PHP - 使用curl绕过短URI

时间:2017-03-28 05:41:38

标签: php curl

您好我想使用curl绕过短链接URL。敌人示例www.bypass.com/8765此链接隐藏www.example.com如何绕过此隐藏链接。

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, "https://example.com/cGTgb2");
curl_setopt($ch, CURLOPT_USERAGENT,'Opera/9.80 (Series 60; Opera Mini/6.5.27309/34.1445; U; en) Presto/2.8.119 Version/11.10');
curl_setopt($ch, CURLOPT_COOKIEFILE,"cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR,"cookie.txt");                               
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
$data = curl_exec($ch);
curl_close($ch);

1 个答案:

答案 0 :(得分:0)

快速查看源代码可以得到以下内容

<noscript>This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser.</noscript>

和javascript为

try {  
    location.reload(true);  
} catch (err1) {  
    try {  
        location.reload();  
    } catch (err2) {  
        location.href = getHostUri();  
    }  
}

告诉我重定向是基于js代码的。现在curl只能用于获取内容。我可能会建议在执行js后使用phantomjsselinium来获取链接。