Advertisement
Guest User

status

a guest
May 23rd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2. require("../mainconfig.php");
  3.  
  4. $check_order = mysqli_query($db, "SELECT * FROM orders_pulsa WHERE status IN ('Pending','Processing')");
  5.  
  6. if (mysqli_num_rows($check_order) == 0) {
  7.   die("Order Pending not found.");
  8. } else {
  9.   while($data_order = mysqli_fetch_assoc($check_order)) {
  10.     $o_oid = $data_order['oid'];
  11.     $o_poid = $data_order['oid'];
  12.   if ($o_provider == "MANUAL") {
  13.     echo "Order manual<br />";
  14.   } else {
  15.     $key = "MASUKIN API KEY MU";
  16.     $api_postdata = "key=$key&method=view&order_id=$o_poid";
  17.    
  18.     $ch = curl_init();
  19.     curl_setopt($ch, CURLOPT_URL, "https://www.all-orionpanel-5.co.id/API?type=pulsa");
  20.     curl_setopt($ch, CURLOPT_POST, 1);
  21.     curl_setopt($ch, CURLOPT_POSTFIELDS, $api_postdata);
  22.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  23.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  24.     $chresult = curl_exec($ch);
  25.     curl_close($ch);
  26.     $json_result = json_decode($chresult, true);
  27.     $u_status = $json_result['order_id'];
  28.    
  29.     $update_order = mysqli_query($db, "UPDATE orders_pulsa SET status = '$u_status' WHERE oid = '$o_oid'");
  30.     if ($update_order == TRUE) {
  31.       echo "$o_oid status $u_status<br />";
  32.     } else {
  33.       echo "Error database.";
  34.     }
  35.   }
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement