Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://www.bluedart.com/servlet/RoutingServlet?handler=tnt&action=custawbquery&loginid=MAA00001&format=xml&lickey=a28f0bb8690c75ce3368bb1c76ea98bc&verno=1.3&scan=1&awb=awb&numbers=14539611450
- $url = "https://www.bluedart.com/servlet/RoutingServlet?handler=tnt&action=custawbquery&loginid=MAA00001&format=xml&lickey=a28f0bb8690c75ce3368bb1c76ea98bc&verno=1.3&scan=1&awb=awb&numbers=14539611450";
- try {
- echo $i."-";
- $xml = simplexml_load_file($url);
- if(false === $xml) {
- echo "Failed Loading XML";
- foreach(libxml_get_errors() as $errors) {
- echo "t", $errors->message ."##";
- }
- $updateFlag=0;
- }
- } catch(Exception $e) {
- echo "ERROR::";
- print_r($e);
- }
- libxml_use_internal_errors(true); //to get the errors from libxml_get_errors()
- $url = "https://www.bluedart.com/servlet/RoutingServlet?handler=tnt&action=custawbquery&loginid=MAA00001&format=xml&lickey=a28f0bb8690c75ce3368bb1c76ea98bc&verno=1.3&scan=1&awb=awb&numbers=14539611450";
- $i = 2; //to get rid of notice error. remove this line
- function getXml($url) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- //curl_setopt($ch, CURLOPT_CAINFO, "/path/to/cacert.pem"); //absolute path to certificate
- //curl_setopt($ch, CURLOPT_CAINFO, "c:/path/to/cacert.pem");
- $curl_response = curl_exec($ch);
- curl_close($ch);
- return $curl_response;
- }
- try {
- echo $i."-";
- $xml_file = getXml($url);
- $xml = simplexml_load_string($xml_file);
- if(false === $xml) {
- echo "Failed Loading XML";
- foreach(libxml_get_errors() as $errors) {
- echo "t", $errors->message ."##";
- }
- $updateFlag=0;
- }
- // else die(print_r($xml));
- } catch(Exception $e) {
- echo "ERROR::";
- print_r($e);
- }
- SimpleXMLElement Object
- (
- [Shipment] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [WaybillNo] => 14539611450
- )
- [Status] => Incorrect Waybill number or No Information
- [StatusType] => NF
- )
- )
Add Comment
Please, Sign In to add comment