<?php
$XMLreq = '<?xml version="1.0" encoding="UTF-8"?>';
$XMLreq = $XMLreq . '<!DOCTYPE svc_init SYSTEM "http://x.x.x.x/sample.DTD">';
$XMLreq = $XMLreq . '<svc_init ver="1.0.0">';
$XMLreq = $XMLreq . '<object>sample</object>';
$XMLreq = $XMLreq . '</svc_init>';
$URLreq = "http://x.x.x.x/XMLreceive.php";
$ch = curl_init($URLreq);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $XMLreq);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
to read xml data received in post request:
<?php
if(isset($HTTP_RAW_POST_DATA))
{
echo $HTTP_RAW_POST_DATA;
}
?>
No comments:
Post a Comment