Guest User

Untitled

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