FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Re: XMLHttpRequest: POST with Data
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Re: XMLHttpRequest: POST with Data [message #178939] Sun, 26 August 2012 19:43 Go to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Stefan Weiss wrote:

> On 2012-08-26 19:15, Thomas 'PointedEars' Lahn wrote:
>> Christoph Becker wrote:
>>> So for POST requests, when the Content-Type is text/plain (e.g. by using
>>> <form enctype="text/plain">) even non-ASCII characters in the body can
>>> be sent directly. But not all server side "languages" will handle this
>>> (e.g. PHP will not fill in the $_POST variable).
>> PHP is not supposed to fill the $_POST array then; there are no
>> parameters. Indeed, apparently there is no trivial way, if any, to
>> retrieve the message body with PHP then [...]
>
> file_get_contents("php://input")

Thanks, unfortunately it requires allow_url_fopen=1.

> or any other function capable of reading from streams.

Could you provide an example, please?


F'up2 comp.lang.php

PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
Re: XMLHttpRequest: POST with Data [message #178940 is a reply to message #178939] Sun, 26 August 2012 20:06 Go to previous messageGo to next message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma: 0
Member
Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>
>> On 2012-08-26 19:15, Thomas 'PointedEars' Lahn wrote:
>>> Christoph Becker wrote:
>>>> So for POST requests, when the Content-Type is text/plain (e.g. by using
>>>> <form enctype="text/plain">) even non-ASCII characters in the body can
>>>> be sent directly. But not all server side "languages" will handle this
>>>> (e.g. PHP will not fill in the $_POST variable).
>>> PHP is not supposed to fill the $_POST array then; there are no
>>> parameters. Indeed, apparently there is no trivial way, if any, to
>>> retrieve the message body with PHP then [...]
>>
>> file_get_contents("php://input")
>
> Thanks, unfortunately it requires allow_url_fopen=1.

I've just found $HTTP_RAW_POST_DATA
<http://www.php.net/manual/en/reserved.variables.httprawpostdata.php>,
which seems to be a viable alternative for Content-Type "text/plain", if
allow_url_fopen=0.

--
Christoph M. Becker
Re: XMLHttpRequest: POST with Data [message #178971 is a reply to message #178940] Tue, 28 August 2012 13:50 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Christoph Becker wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Stefan Weiss wrote:
>>> On 2012-08-26 19:15, Thomas 'PointedEars' Lahn wrote:
>>>> Christoph Becker wrote:
>>>> > So for POST requests, when the Content-Type is text/plain (e.g. by
>>>> > using <form enctype="text/plain">) even non-ASCII characters in the
>>>> > body can be sent directly. But not all server side "languages" will
>>>> > handle this (e.g. PHP will not fill in the $_POST variable).
>>>> PHP is not supposed to fill the $_POST array then; there are no
>>>> parameters. Indeed, apparently there is no trivial way, if any, to
>>>> retrieve the message body with PHP then [...]
>>> file_get_contents("php://input")
>> Thanks, unfortunately it requires allow_url_fopen=1.
>
> I've just found $HTTP_RAW_POST_DATA
> <http://www.php.net/manual/en/reserved.variables.httprawpostdata.php>,
> which seems to be a viable alternative for Content-Type "text/plain", if
> allow_url_fopen=0.

Thank you, WFM.


Regards,

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Folder Permissions
Next Topic: Changing session variables gives warning
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 01:20:45 GMT 2024

Total time taken to generate the page: 0.02381 seconds