Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Script Get Service Planet-Pedia
- Code By : V1O7ET
- */
- require_once("mainconfig.php");//koneksi kepada database
- $key = "Apikey_Anda"; // your api key
- $postdata = "api_key=$key&action=service";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://planetpedia.xyz/api/sosmed");
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $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, true);
- $indeks=0;
- $i = 1;
- // get data service
- while($indeks < count($json_result)){
- $category = $json_result[$indeks]['category'];
- $id = $json_result[$indeks]['id'];
- $service = $json_result[$indeks]['service'];
- $min = $json_result[$indeks]['min'];
- $max = $json_result[$indeks]['max'];
- $price = $json_result[$indeks]['price'];
- $note = $json_result[$indeks]['note'];
- $status = $json_result[$indeks]['status'];
- $indeks++;
- $i++;
- // end get data service
- // setting price
- $rate = $price;
- $rate_asli = $rate + 849; //setting penambahan harga
- // setting price
- $check_services_pulsa = mysqli_query($db, "SELECT * FROM services WHERE pid = '$id' AND provider='PP'");
- $data_services_pulsa = mysqli_fetch_assoc($check_orders);
- if(mysqli_num_rows($check_services_pulsa) > 0) {
- echo "Service Sudah Ada Di database => $service | $id \n <br />";
- } else {
- $insert=mysqli_query($db, "INSERT INTO services (sid,category,service,note, min, max, price, status, pid, provider) VALUES ('$id','$category','$service','$note','$min','$max','$rate_asli','Active','$id','PP')");//Memasukan Kepada Database (OPTIONAL)
- if($insert == TRUE){
- echo"SUKSES INSERT -> Kategori : $category || SID : $id || Service :$service || Min :$min_order || Max : $max_order ||Price : $rate_asli || Note : $note <br />";
- }else{
- echo "GAGAL MEMASUKAN DATA";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement