|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-13 07:36 UTC] datibbaw@php.net
Description: ------------ i set 'max_redirects' to 1 to disable redirect, but it did not work and produce some error.... 'PHP Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\nlr.ph p on line 66' if i set it to 2, everything works well...redirect works. note: http://172.23.68.8/index.php will simple locate to another url. ;) thanks SHEN ZhiQiang Reproduce code: --------------- $access = "http://172.23.68.8/index.php"; $opts = array( 'http' => array( 'method' => "GET", 'header' => "Accept: */*\r\n" . "Accept-Language: en-us\r\n" . "Accept-Encoding: gzip, deflate\r\n" . "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)\r\n" . //"Host: www.netlibrary.com\r\n" . "Connection: Keep-Alive\r\n", 'max_redirects' => '1' ) ); $context = stream_context_create($opts); $fp = fopen($access, 'r', false, $context); $meta_data = stream_get_meta_data($fp); var_dump($meta_data); file_put_contents('./test.dump', $fp); fclose($fp); Actual result: -------------- PHP Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\nlr.ph p on line 66 Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\nlr.php on line 66 PHP Warning: fopen(http://172.23.68.8/index.php): failed to open stream: No err or in D:\webroot\nlr.php on line 66 Warning: fopen(http://172.23.68.8/index.php): failed to open stream: No error in D:\webroot\nlr.php on line 66 PHP Warning: stream_get_meta_data(): supplied argument is not a valid stream re source in D:\webroot\nlr.php on line 67 Warning: stream_get_meta_data(): supplied argument is not a valid stream resourc e in D:\webroot\nlr.php on line 67 bool(false) PHP Warning: fclose(): supplied argument is not a valid stream resource in D:\w ebroot\nlr.php on line 70 Warning: fclose(): supplied argument is not a valid stream resource in D:\webroo t\nlr.php on line 70 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
I get the same error if I just want to download the mirror selection page: file_put_contents('xampp-win32-1.6.4.exe.html', file_get_contents('http://downloads.sourceforge.net/xampp/xampp-win32-1.6.4.exe?use_mirror=osdn', FALSE, stream_context_create(array('http'=>array('max_redirects'=>1))), 0, 10000));