i want to implement the tour API of globus tour :- "http://webapi.globusandcosmos.com/gvitawapi.asmx?op=GetAllAvailableMediaToursXML" i am using following code to run xml $xml= ' Globus '; $url='http://localhost/api/api.php';
$ch= curl_init('http://localhost/api/api.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$xml);
$result= @curl_exec($ch); print_r($result); die;
if($result=== false) {
echo "Error performing request";
}else{
$xml_doc= simplexml_load_string($result);
echo 'Status is ',$xml_doc->status,'<br/>';
if($xml_doc->status =='SUCCESS') {
echo 'Data is ',$xml_doc->data,'<br/>';
}else{
echo 'Error is ',$xml_doc->errormessage,'<br/>';
}
}
but it keeps loading the page. please correct me if i am wrong
you must close the curl connection after execute curl_close($ch);
here at your line
$result= @curl_exec($ch);curl_close($ch); print_r($result); die;