Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6868 > unrolled thread

Re: XMLHttpRequest: POST with Data

Started byThomas 'PointedEars' Lahn <PointedEars@web.de>
First post2012-08-26 21:43 +0200
Last post2012-08-28 15:50 +0200
Articles 3 — 2 participants

Back to article view | Back to comp.lang.php

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-26 21:43 +0200
    Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-26 22:06 +0200
      Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-28 15:50 +0200

#6868 — Re: XMLHttpRequest: POST with Data

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-08-26 21:43 +0200
SubjectRe: XMLHttpRequest: POST with Data
Message-ID<6503747.LP8xm1ciM4@PointedEars.de>
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@news.demon.co.uk> (2004)

[toc] | [next] | [standalone]


#6869

FromChristoph Becker <cmbecker69@gmx.de>
Date2012-08-26 22:06 +0200
Message-ID<k1dvjk$2gj$1@speranza.aioe.org>
In reply to#6868
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

[toc] | [prev] | [next] | [standalone]


#6898

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-08-28 15:50 +0200
Message-ID<20412327.jQFHGDmDgm@PointedEars.de>
In reply to#6869
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.)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web