Re: New globals for PUT and DELETE
| From: | Rowan Collins | Date: | Wed, 15 Oct 2014 22:01:26 +0000 |
| Subject: | Re: New globals for PUT and DELETE | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78099@lists.php.net to get a copy of this message | ||
On 15 October 2014 22:14:32 GMT+01:00, Ralph Schindler <ralph@ralphschindler.com> wrote:
>>> I'm not sure I understand what you're trying to do, could you
>explain in
>>> more detail with examples?
>>
>> PUT /url
>> Content-type: application/x-www-form-urlencoded
>>
>> parse_str (file_get_contents(‘php://input'), $_POST) // Ok
>>
>> PUT /url
>> Content-type: multipart/mixed; boundary="xxxx"
>>
>> file_get_contents(‘php://input') // Empty string
>
>Here is a demonstration of this script, and a successful read of the
>request body:
>
> $ echo 'FOOOO=BARRRRR' | http --verbose PUT localhost:8000 \
> Content-Type:'multipart/mime; boundry=xxxxx'
>
> PUT / HTTP/1.1
> Accept: application/json
> Accept-Encoding: gzip, deflate
> Content-Length: 14
> Content-Type: multipart/mime; boundry=xxxxx
> Host: localhost:8000
> User-Agent: HTTPie/0.8.0
I'm not sure if itmakes a difference, but you mistyped the content type there: it should be
multipart/mixed, not multipart/mime.
There may also be version differences at play here, because I think the behaviour of php://input has
been changed a couple of times.