#50719 [Opn->Bgs]: get_headers and file_get_contents always follows location redirect

From: Date: Mon, 11 Jan 2010 12:32:54 +0000
Subject: #50719 [Opn->Bgs]: get_headers and file_get_contents always follows location redirect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146532@lists.php.net to get a copy of this message
ID: 50719 Updated by: iliaa@php.net Reported By: php at hm2k dot org -Status: Open +Status: Bogus Bug Type: Streams related PHP Version: 5.3.1 New Comment: You can control the number of redirects (or disable them entirely) via the max_redirects streams context option. Previous Comments: ------------------------------------------------------------------------ [2010-01-11 12:18:28] php at hm2k dot org Description: ------------ get_headers and file_get_contents should not blindly follow the location redirect. The reason for this is that I, like others, want to get_headers of the url i've supplied, not the ultimate location. I'm not the only one having this issue, also see: http://www.php.net/manual/en/function.get-headers.php#90434 Reproduce code: --------------- $headers=get_headers('http://tinyurl.com/hm2k'); Expected result: ---------------- echo $headers['Location']; //returns http://connecting.nokia.com/NOKIA/WWW/HRJEdisc.nsf/HNew/0CB2705072779CACC2256D630080E7F4 Actual result: -------------- Warning: get_headers(http://tinyurl.com/hm2k) [function.get-headers]: failed to open stream: Connection timed out ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50719&edit=1

« previous php.bugs (#146532) next »