Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \<?php
- require("../mainconfig.php");
- $check_order = mysqli_query($db, "SELECT * FROM orders_pulsa WHERE status IN ('','Pending','Processing') AND provider = 'ATL'");
- if (mysqli_num_rows($check_order) == 0) {
- die("Order Pending not found.");
- } else {
- while($data_order = mysqli_fetch_assoc($check_order)) {
- $o_oid = $data_order['oid'];
- $o_provider = $data_order['provider'];
- if ($o_provider == "MANUAL") {
- echo "Order Manual<br />";
- } else {
- $check_provider = mysqli_query($db, "SELECT * FROM provider WHERE code = 'ATL'");
- $data_provider = mysqli_fetch_assoc($check_provider);
- $p_apikey = $data_provider['api_key'];
- if ($o_provider != "MANUAL") {
- $api_postdata = "api_key=R4ND0MK3Y&code=$o_oid";
- } else {
- die("System error!");
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://serverh2h.web.id/status/pulsa');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $api_postdata);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $chresult = curl_exec($ch);
- echo $chresult;
- curl_close($ch);
- $json_result = json_decode($chresult);
- if ($o_provider == "ATL") {
- $u_status = $json_result->status;
- $u_catatan = $json_result->catatan;
- if ($u_status == "Pending") {
- $un_status = "Pending";
- } else if ($u_status == "Processing") {
- $un_status = "Processing";
- } else if ($u_status == "Error") {
- $un_status = "Error";
- } else if ($u_status == "Success") {
- $un_status = "Success";
- } else {
- $un_status = "Pending";
- }
- }
- $update_order = mysqli_query($db, "UPDATE orders_pulsa SET status = '$un_status' WHERE oid = '$o_oid'");
- if ($update_order == TRUE) {
- echo "<br />ID Pesanan Web: $o_oid<br /> Status: $un_status<br /><br />";
- } else {
- echo "Error database.";
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement