Guest User

Untitled

a guest
Aug 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. 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
  2.  
  3. $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";
  4. try {
  5. echo $i."-";
  6. $xml = simplexml_load_file($url);
  7. if(false === $xml) {
  8. echo "Failed Loading XML";
  9. foreach(libxml_get_errors() as $errors) {
  10. echo "t", $errors->message ."##";
  11. }
  12. $updateFlag=0;
  13. }
  14. } catch(Exception $e) {
  15. echo "ERROR::";
  16. print_r($e);
  17. }
  18.  
  19. libxml_use_internal_errors(true); //to get the errors from libxml_get_errors()
  20.  
  21. $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";
  22.  
  23. $i = 2; //to get rid of notice error. remove this line
  24.  
  25. function getXml($url) {
  26. $ch = curl_init($url);
  27. curl_setopt($ch, CURLOPT_HEADER, 0);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  29. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  30. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  31. //curl_setopt($ch, CURLOPT_CAINFO, "/path/to/cacert.pem"); //absolute path to certificate
  32. //curl_setopt($ch, CURLOPT_CAINFO, "c:/path/to/cacert.pem");
  33. $curl_response = curl_exec($ch);
  34. curl_close($ch);
  35. return $curl_response;
  36. }
  37.  
  38. try {
  39. echo $i."-";
  40. $xml_file = getXml($url);
  41. $xml = simplexml_load_string($xml_file);
  42. if(false === $xml) {
  43. echo "Failed Loading XML";
  44. foreach(libxml_get_errors() as $errors) {
  45. echo "t", $errors->message ."##";
  46. }
  47. $updateFlag=0;
  48. }
  49. // else die(print_r($xml));
  50. } catch(Exception $e) {
  51. echo "ERROR::";
  52. print_r($e);
  53. }
  54.  
  55. SimpleXMLElement Object
  56. (
  57. [Shipment] => SimpleXMLElement Object
  58. (
  59. [@attributes] => Array
  60. (
  61. [WaybillNo] => 14539611450
  62. )
  63. [Status] => Incorrect Waybill number or No Information
  64. [StatusType] => NF
  65. )
  66.  
  67. )
Add Comment
Please, Sign In to add comment