ID:               45503
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michael at mcihael-menzel dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         HTTP related
 Operating System: debian linux
 PHP Version:      5.2.6
 New Comment:

So the problem is that you can't pass POST stuff to this script?
Where's that part in this example? You only included the irrelevant part
here, perhaps it would be more obvious if we saw the actual POST form
you use.


Previous Comments:
------------------------------------------------------------------------

[2008-07-13 22:03:05] michael at mcihael-menzel dot com

Description:
------------
when recieving POST HTTP messages which have text/xml content in the
message body this content can't be accessed:
  - php://input is empty
  - $HTTP_RAW_POST_DATA is empty (though enabled in php.ini)
  - neither do $_POST, $_SERVER and $_REQUEST not contain the data (as
expected and correct)
  - neither does $_FILE contain anything (last obvious possibility)
  - even installation of pecl extension pecl_http 1.6 can't solve it
(none of the given functions/methods did work)




Reproduce code:
---------------
        $headers = getHeaders();

        $ch = curl_init();

        $headers[Host] = ""; # to be filled with a XML webservice URL
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_URL, ""); # to be filled with a XML
webservice URL
        curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);

        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POSTFIELDS,
file_get_contents("php://input")); # replace with any method/function to
get the POST content

        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $httpContent = curl_exec($ch);

        curl_close($ch);

        echo $httpContent;
        $h = fopen("responsecontent.log", "a");
        fwrite($h, "\n\n" . $httpContent);
        fclose($h);




        function getHeaders() {
        
                $h = fopen("headers.log", "a");
                fwrite($h, "\n\n");
                $headers = array();
                foreach ($_SERVER as $k => $v) {
                        if (substr($k, 0, 5) == "HTTP_") {
                                $k = str_replace('_', ' ', substr($k, 5));
                                $k = str_replace(' ', '-', 
ucwords(strtolower($k)));
                                $headers[$k] = $v;
                                fwrite($h, $k . ": " . $v . "\n");
                        }
                }
                fclose($h);

                return $headers;
        }





Expected result:
----------------
XML webservice answers to the POST request forwarded with curl.

"reproduce code" doesn't contain the line to test the contents. in the
beginning of the script all possible places where the POST content might
be placed by PHP are written to a file. 

The file only gets filled by IE requests which send the data in a
second HTTP (TCP-, IP-) packet. Firefox sends the whole request with
content-type: text/xml in one packet and content is not accessible.

Actual result:
--------------
empty response by curl due to the empty post content sent to the
webservice


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45503&edit=1

Reply via email to