php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54938 HTTP context with POST method should return response body
Submitted: 2011-05-27 11:23 UTC Modified: 2011-05-27 15:16 UTC
From: simast at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.3.6 OS: Linux/Ubuntu
Private report: No CVE-ID: None
 [2011-05-27 11:23 UTC] simast at gmail dot com
Description:
------------
Apparently, having a POST method HTTP context request does not return response 
body back. Tested with stream_get_contents() but I suspect it does affect other 
similar functions as well (file_get_contents/fread).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-27 12:06 UTC] johannes@php.net
-Status: Open +Status: Feedback
 [2011-05-27 12:06 UTC] johannes@php.net
Are you sure your server response with some content? This works fine:

<?php
$opts = array(
  'http'=>array(
    'method'=>'POST'  )
);

$context = stream_context_create($opts);
$fp = fopen('http://php.net', 'r', false, $context);
echo stream_get_contents($fp);
?>
 [2011-05-27 12:12 UTC] simast at gmail dot com
-Status: Feedback +Status: Open
 [2011-05-27 12:12 UTC] simast at gmail dot com
My bad - content is only returned on 200 OK response code. So this bug is related 
to http://bugs.php.net/bug.php?id=54898. And once that is sorted - this should 
work too.
 [2011-05-27 15:16 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2011-05-27 15:16 UTC] johannes@php.net
closing this one then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 09:01:29 2024 UTC