Showing posts with label post xml data in PHP. Show all posts
Showing posts with label post xml data in PHP. Show all posts

Tuesday, October 11, 2011

Script for RAW HTTP REQUEST (posting raw data in XML)

$raw = new HttpRequest(“http://host-name/services/airplayer/”, HttpRequest::METH_POST);

store your xml in the variable $xml

$raw->setContentType(“text/xml charset=utf-8″);
$a = $raw->setRawPostData($xml);
$raw->addRawPostData($xml);
$message = new HttpMessage();
$message = $raw->send();
echo $message->tostring();

To use HttpRequest class u need to uncomment the php_http.dll present in u r php.ini file and then restart u r apache.

while creating object, you need to specify the php file location url where u receive the RAW HTTP REQUEST

here u can sepcify php script located on diferent server also.

second parameter denotes method i.e GET OR POST u can send raw data either in POST format OR in GET format.