Skip to Content »

FlashApe » Sending XML to PHP

 Sending XML to PHP

  • October 5th, 2006
  • 12:06 pm

wow, i can't believe I've never run into this before, I guess I never had to send xml TO a php script from flash before. Anyway, there are two ways to read the xml being sent to the php page. The first is $HTTP_RAW_POST_DATA. This is a global variable created to hold content sent to the page that who's content type is not set to application/x-www.form-urlencoded or multipart/form-data. Using $HTTP_RAW_POST_DATA can be a little flaky because it depends on version/php ini information.

Another way to access the raw php data being sent to the page is to read from the input stream directly by using php://input. You would use that any place where you would pass a file name, such as:

PHP:
  1. echo file_get_contents("php://input");

According to the php docs, using php://input uses less momory than $HTTP_RAW_POST_DATA.

1 Person had this to say...

Gravatar
  • Josh
  • October 5th, 2006
  • 1:33 pm

I've also noticed that sometimes only one or the other will work on some server setups. Unfortunately, I never discovered the cause.

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>