php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27628 stream http context
Submitted: 2004-03-17 16:25 UTC Modified: 2004-03-17 19:31 UTC
From: php at virtualmonet dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5CVS-2004-03-17 (dev) OS: linux
Private report: No CVE-ID: None
 [2004-03-17 16:25 UTC] php at virtualmonet dot com
Description:
------------
hi;

It seems that the Context option 'content' of HTTP wrapper for stream, does not pass the value to the server.

Reproduce code:
---------------
// === client side php code === 

$opts = array('http'=>array('method'=> "POST",
                            'content' => 'foo=bar'));

$context = stream_context_create($opts);

echo file_get_contents ($url, false, $context);




// === server side php code ===
print $_POST['foo'];


Expected result:
----------------
bar


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-17 19:31 UTC] pollita@php.net
Because that's not a complete POST request.

You also need to specify the correct content-type (and preferrably content-length) in the header. (You can use the header context option for this)  Refer to example2 on http://www.php.net/stream if you need an example of what the headers should look like.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC