Guest User

gfrr

a guest
Mar 2nd, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2.  
  3. require_once("dbcontroller.php");
  4. $db_handle = new DBController();
  5.  
  6. //$curl_data['username']='outthinking781346';
  7. //$curl_data['password']='ouhk78epe34csmed46d';
  8.  
  9. $data['username']='outthinking781346';
  10. $data['password']='ouhk78epe34csmed46d';
  11.  
  12.  
  13. $data = json_decode(stripslashes($_POST['data']));
  14. $response = array();
  15.  
  16. foreach($data as $id){
  17.  
  18. $orderid = $id;
  19. //$curl_data['awb']=$orderid;
  20.  
  21. $data['awb']=$orderid;
  22.  
  23. $hide = '';
  24. $url = 'https://api.ecomexpress.in/track_me/api/mawbd/?awb=&order=&username=outthinking781346&password=ouhk78epe34csmed46d';
  25. $ch = curl_init();
  26.  
  27. curl_setopt($ch, CURLOPT_URL,$url);
  28. curl_setopt($ch, CURLOPT_POST, true);
  29. curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_data);
  30. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  31.  
  32.  
  33. $output = curl_exec ($ch);
  34. curl_close($ch);
  35. $res = explode("\n",$output);
  36.  
  37. if ( ! isset($res[13]))
  38. {
  39. $res[13] = null;
  40. }
  41.  
  42.  
  43.  
  44. $status = str_replace('</field>','',$res[13]);
  45.  
  46.  
  47.  
  48. $statusfinal = str_replace('<field type="CharField" name="status">','',$status);
  49. if($statusfinal!='')
  50. {
  51. $sqlecom = "UPDATE do_order set in_transit='".$statusfinal."',tconformed_by='Ecom' where tracking_id=".$orderid;
  52. $db_handleecom = new DBController();
  53. $resultecom = $db_handleecom->executeUpdate($sqlecom);
  54. }
  55.  
  56. // store the responce in array
  57.  
  58.  
  59. $response[$orderid] = $statusfinal;
  60.  
  61. }
  62. echo json_encode($response);
  63.  
  64. //return $response;
  65.  
  66. ?>
Add Comment
Please, Sign In to add comment