function get_real_url($myurl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $myurl);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_exec($ch);
if (empty($ret)) {
die(curl_error($ch));
curl_close($ch);
return false;
} else {
$info = curl_getinfo($ch);
curl_close($ch);
if (empty($info['http_code'])) {
return false;
} else {
return $info['url'];
}
}
}
PHP获得短域名的真实地址
最新推荐文章于 2024-04-28 11:25:26 发布