我想在我的服务器上完成处理后将用户重定向到远程服务器。有时,由于用户端的网络连接超时,重定向不会发生,导致他/她的页面无法获得更新状态。PHP检测URL是否重定向并重试重定向
我目前使用的是什么
header('Location: http://anotherwebsite.com');
如果失败,就不会再试一次...我怎么能实现的东西,“将再次尝试”
$retry_limit = 0;
while(//http status code not 301 or 302 && $retry_limit < 3)
{
header('Location: http://anotherwebsite.com');
$retry_limit++;
}
我很困惑如果我使用cURL,那么它会双重重定向,如果我也实现标题...或者我误解了它?
非常感谢!
检查了这一点,也许它可以帮助http://stackoverflow.com/questions/2964834/php-check-if-url-redirects尤其答案这里http://stackoverflow.com/a/2965116/1202367 – 2013-02-27 08:58:37
回溯信息不是可用的吗? [PHP的debug_backtrace](http://php.net/manual/en/function.debug-backtrace.php) – 2013-02-27 08:59:27
你应该真的要求远程服务器运营商提高其正常运行时间... – pixelistik 2013-02-27 09:24:14