1

嗨,我对 stackoverflow 很陌生,我正在尝试开发一个脚本来从缩短的链接中获取实际隐藏的链接。

我想知道的是,有没有办法从带有 PHP 或 cURL 的 adf.ly 链接获取实际(最终隐藏)链接?

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;
  }
}
4

0 回答 0