#40849 [Opn->Fbk]: file_get_context context parameter doesn't work
| From: | tony2001@php.net | Date: | Mon, 19 Mar 2007 09:23:13 +0000 |
| Subject: | #40849 [Opn->Fbk]: file_get_context context parameter doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110491@lists.php.net to get a copy of this message | ||
ID: 40849
Updated by: tony2001@php.net
Reported By: djgrrr+phpbugs at p2p-network dot net
-Status: Open
+Status: Feedback
Bug Type: Streams related
Operating System: Linux 2.6
PHP Version: 5.2.1
New Comment:
$_POST = array (
'var1' => 'some content',
'var2' => 'doh',
);
Cannot reproduce.
Previous Comments:
------------------------------------------------------------------------
[2007-03-18 21:46:58] djgrrr+phpbugs at p2p-network dot net
Description:
------------
On windows it works fine, but, with *nix and possibly *bsd, the context
parameter to file_get_contents does absolutely nothing, meaning you
can't change the method, submit post data, change the bind ip, etc, with
file_get_contents().
The example shown in the docs does not work
http://us3.php.net/manual/en/wrappers.http.php
Reproduce code:
---------------
<?php
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
echo file_get_contents('http://www.p2p-network.net/vars.php',
false,
$context);
?>
Expected result:
----------------
i expect the returned post array from this script to be populated,
which it would be if you did an actually post query on
http://www.p2p-network.net/vars.php
if you run this from windows, it works fine and shows up like this:
$_POST = array (
'var1' => 'some content',
'var2' => 'doh',
);
Actual result:
--------------
if you try the same code on *nix you get an empty post array:
$_POST = array (
);
and if you look at the $_SERVER array you can see that none of the
context options did anything
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40849&edit=1