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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at virtualmonet dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Nov 21 14:01:29 2024 UTC