Advertisement
Guest User

Get Service Sosmed Planetpedia

a guest
Oct 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. <?php
  2. /*
  3. Script Get Service Planet-Pedia
  4. Code By : V1O7ET
  5. */
  6. require_once("mainconfig.php");//koneksi kepada database
  7. $key = "Apikey_Anda"; // your api key
  8. $postdata = "api_key=$key&action=service";
  9.  
  10. $ch = curl_init();
  11. curl_setopt($ch, CURLOPT_URL, "https://planetpedia.xyz/api/sosmed");
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  16. $chresult = curl_exec($ch);
  17. //echo $chresult;
  18. curl_close($ch);
  19. $json_result = json_decode($chresult, true);
  20. $indeks=0;
  21. $i = 1;
  22. // get data service
  23. while($indeks < count($json_result)){
  24.  
  25. $category = $json_result[$indeks]['category'];
  26. $id = $json_result[$indeks]['id'];
  27. $service = $json_result[$indeks]['service'];
  28. $min = $json_result[$indeks]['min'];
  29. $max = $json_result[$indeks]['max'];
  30. $price = $json_result[$indeks]['price'];
  31. $note = $json_result[$indeks]['note'];
  32. $status = $json_result[$indeks]['status'];
  33. $indeks++;
  34. $i++;
  35. // end get data service
  36. // setting price
  37. $rate = $price;
  38. $rate_asli = $rate + 849; //setting penambahan harga
  39. // setting price
  40. $check_services_pulsa = mysqli_query($db, "SELECT * FROM services WHERE pid = '$id' AND provider='PP'");
  41. $data_services_pulsa = mysqli_fetch_assoc($check_orders);
  42. if(mysqli_num_rows($check_services_pulsa) > 0) {
  43. echo "Service Sudah Ada Di database => $service | $id \n <br />";
  44. } else {
  45.  
  46. $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)
  47. if($insert == TRUE){
  48. echo"SUKSES INSERT -> Kategori : $category || SID : $id || Service :$service || Min :$min_order || Max : $max_order ||Price : $rate_asli || Note : $note <br />";
  49. }else{
  50. echo "GAGAL MEMASUKAN DATA";
  51.  
  52. }
  53. }
  54. }
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement