您好我是stackoverflow的新手,我正在尝试开发一个脚本来从缩短的链接中获取实际的隐藏链接。
我想知道的是,有没有办法从adf.ly链接获得PHP或cURL的实际(最终隐藏)链接?
function get_link($url){
$redirect_url = null;
if(function_exists("curl_init")){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_exec($ch);
$redirect_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
return $redirect_url;
}
}