Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Reading data posted with XMLHttprequest
- Peter Gaunt
February 20, 2005, 11:06 pm
rate this thread
I'm trying to post a form (using POST not GET) using the xmlHttpRequest
object. I cannot work out how to get PHP (4.1.2) to read the data which
I'm submitting. Everything works fine if I use GET I can just read it
from $_GET. If I use POST nothing appears in $_POST.
To try to use the POST method I'm encoding the fields into a URL
encoded string and sending it as the parameter to the request.send()
in the LiveHHTPHeaders extension to Firefox. Presumably it's being
received by the server. But how on earth do I get at it!? Been driving
me completely crazy.
*** Email is pete -at- dawnsun -dot- net
- Janwillem Borleffs
February 21, 2005, 2:46 am
Re: Reading data posted with XMLHttprequest
Peter Gaunt wrote:
I have never worked with XMLHttpRequest, but when the data is posted and the
data doesn't show up in the $_POST array, it's probably sent as raw post
To get this data, you should enable the always_populate_raw_post_data
directive in your php.ini file, after which you should be able to receive
the data through the $HTTP_RAW_POST_DATA variable.
re:Reading data posted with XMLHttprequest
to use the $_POST global without enabling the raw data in php.ini, try
the following code:
http://eye.cc -php- web design
- R. Rajesh Jeba Anbiah
April 10, 2005, 3:00 pm