简体   繁体   English

获取重定向页面的URL-PHP

[英]Getting the URL of redirected page - PHP

I have this URL to which I'm trying to redirected the page: http://www.hotukdeals.com/visit?m=1650&q=1542029 我有一个我要重定向页面的URL: http : //www.hotukdeals.com/visit? m=1650&q =1542029

I already tried: 我已经尝试过:

$ch1 = curl_init("http://www.hotukdeals.com/visit?m=1650&q=1542029"); 
    curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch1, CURLOPT_NOBODY, TRUE);
    curl_exec($ch1);
    $curl_url = curl_getinfo($ch1, CURLINFO_EFFECTIVE_URL);
    echo $curl_url;

I'm getting this response, which is the same URL: 我收到此响应,它是相同的URL:

http://www.hotukdeals.com/visit?m=1650&q=1542029 http://www.hotukdeals.com/visit?m=1650&q=1542029

How can I get this to work? 我该如何工作?

Thank you. 谢谢。

在大多数情况下,这应该可行,除非使用Javascript进行重定向。

print_r(get_headers('http://www.hotukdeals.com/visit?m=1650&q=1542029'));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM