code is as below:
<?php
//set up variables
$theData = '<?xml version="1.0"?>
<note>
<to>php.net</to>
<from>lymber</from>
<heading>php http request</heading>
<body>i love php!</body>
</note>';
$url = 'http://www.example.com/script.php';
//create the httprequest object
$httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST, $options);
//add the content type
$httpRequest_OBJ->setContentType = 'Content-Type: text/xml';
//add the raw post data
$httpRequest_OBJ->setRawPostData ($theData);
//send the http request
$result = $httpRequest_OBJ->send();
//print out the result
echo "<pre>"; print_r($result); echo "</pre>";
?>
Now httprequest calls the script here:
http://www.example.com/script.php
Over there I want to access the object, so that I can manipulate the data and send it back:
$httpRequest_OBJ->setRawPostData ($theData);
but it does not work. I tried $_POST['theData'], but this only works if you use $r->**addPostFields**(array('user' => 'mike', 'pass' => 's3c|r3t'));
How can I access the object $theData?
Thanks.
I think what you are after is php://input
So you can get the whole lot of XML that you posted like this:
As a side note, I think the line
…should probably just read