note 112318 deleted from function.http-get-request-body by sobak
| From: | sobak@php.net | Date: | Sun, 04 Dec 2016 07:20:46 +0000 |
| Subject: | note 112318 deleted from function.http-get-request-body by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208048@lists.php.net to get a copy of this message | ||
Note Submitter: slave at codegrunt dot com
----
In case this saves anyone else some frustration, the "Content-Length" header decides what
will be returned for "php://input". If you leave it out while testing, nothing will be
returned for "php://input" or $HTTP_RAW_POST_DATA.
For example, if you are trying to test out a custom SOAP server app and you send a request like this
without a Content-Length set:
-----
POST /soap_service.php HTTP/1.1
Authorization: Basic abcdefgh
User-Agent: SOAPy McSOAPclient
Host: example.com
Accept: */*
MIME-Version: 1.0
Content-type: text/xml; charset=utf-8
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cat="http://com.soapy/foobar"><soapenv:Header/><soapenv:Body><foo:ManageBar><foo:task
id="1"><foo:getBar
type="helloworld"/></foo:task></foo:ManageBar></soapenv:Body></soapenv:Envelope>
----
"php://input" will always return and empty string.