Guest User

fef

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