Retrieving raw data from a post

Sometimes it can by useful to send xml data to a receiving script in order to let this script perform tasks on it without user interaction, such as a webservice.
It can be done easily by using the following php code.

retrieving xml (or other) raw data from a post:

$data = trim(file_get_contents(‘php://input’)); // get the (xml) data from sender

$processed=processData($data); // do something with the data

echo $processed; // sends data back to requesting client

Post to Twitter Tweet This Post

Tags:

Laat een reactie achter

  1. remco Zegt:

    Marc, volgens mij moet je hier wat meer uitleg bijgeven, want dit is wel erg kort door de bocht… of twitter het ;)

  2. marc Zegt:

    Zeau goed? Of snap je het nog niet ;)

Laat een reactie achter