|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-29 09:52 UTC] RQuadling at GMail dot com
Description: ------------ When using a stream_context, the "From:" header is added to the request, even though the "From:" header is documented to be used for anonymous FTP requests. I don't know how to read the headers being SENT when using a stream_context, so I had to use WireShark. The results below relate to the output of WireShark. Test script: --------------- <?php file_get_contents( 'http://www.php.net', False, stream_context_create( array( 'http' => array( 'method' => 'GET', 'header' => "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.18 Safari/534.10\r\n", ) ) ) ); Expected result: ---------------- GET / HTTP/1.0 Host: www.php.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.18 Safari/534.10 Actual result: -------------- GET / HTTP/1.0 From: AutomatecTasks@[EDITED] Host: www.php.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.18 Safari/534.10 PatchesRemove-from-header-for-http-streams (last revision 2010-10-29 08:16 UTC by RQuadling at GMail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Using ini_set('from', 'junk@junk.com'); has no effect on the output in WireShark. Using ... <?php ini_set('from', 'noone@home.com'); file_get_contents( 'http://www.php.net/Test1', False, ... shows GET /Test1 HTTP/1.0 From: AutomatecTasks@Bandvulc.co.uk Host: www.php.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.18 Safari/534.10 and the response includes ... Location: http://uk3.php.net/Test1 and that request also includes the From: header. So, if 'from' is kept as an option, the documentation is out as it is not a PHP_INI_ALL entry.