Bug #52666 [Fbk->NoF]: file_get_contents function can not set the HTTP headers
Edit report at https://bugs.php.net/bug.php?id=52666&edit=1
ID: 52666
Updated by: php-bugs@lists.php.net
Reported by: chopins dot xiao at gmail dot com
Summary: file_get_contents function can not set the HTTP
headers
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Filesystem function related
Operating System: Fedora 13
PHP Version: 5.2.14
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-08-23 05:42:10] aharvey@php.net
I can't reproduce this on 5.2.13 or the current 5.2 snapshot under any configuration I can come
up with. Request headers always seem to be sent as expected.
As 5.2 is closed for bug fixes, can you please see if the bug occurs with PHP 5.3.3? If it does,
please also provide your configure line from phpinfo().
------------------------------------------------------------------------
[2010-08-22 13:04:59] chopins dot xiao at gmail dot com
Description:
------------
My PHP is 5.2.13,if use under code
<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example.com/', false, $context);
?>
use Wireshark check HTTP request header is:
User-Agent: PHP/5.2.13\r\n
Host: en.wikipedia.org\r\n
Accept: */*\r\n
I set header not exists
Test script:
---------------
<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
Expected result:
----------------
User-Agent: PHP/5.2.13\r\n
Host: en.wikipedia.org\r\n
Accept-language: en\r\n
Cookie: foo=bar\r\n
Actual result:
--------------
User-Agent: PHP/5.2.13\r\n
Host: en.wikipedia.org\r\n
Accept: */*\r\n
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52666&edit=1
Thread (3 messages)