I'm working on a local Ubuntu system. Now I'm trying to send a XML request to an application in a remote server through cURL. Below is the XML :
<?php
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<Student>
<Name>John</Name>
<Age>5</Age>
</Student>
$url="http://www.test.com/testapp?request=";
$xml =htmlentities($xml);
echo $xml;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/xml; charset=utf-8"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $result;
}?>
My problem is I'm not able to connect to the web application external remote server.But, in local system the page redirects to another page .How can I trace whether my request is sent to the remote server.When I try to access the URL manually from browser, I'm able to access the web application. So what should I do to know whether the XML request is sent or not.