diamondpedia

SCRIPT GET CATEGORY PULSA DPEDIA

Jun 20th, 2019
231
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_once("mainconfig.php");
  3.  
  4. $postdata = "api_key=MASUKAN-API-KEY-DISINI";
  5.  
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_URL, "https://serverh2h.net/service/pulsa");
  8. curl_setopt($ch, CURLOPT_POST, 1);
  9. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12. $chresult = curl_exec($ch);
  13. //echo $chresult;
  14. curl_close($ch);
  15. $json_result = json_decode($chresult, true);
  16. $indeks=0;
  17. while($indeks < count($json_result)){
  18. $oprator = $json_result[$indeks][oprator];
  19. $tipe = $json_result[$indeks][tipe];
  20. $indeks++;
  21.  
  22.  $check_services_pulsa = mysqli_query($db, "SELECT * FROM service_dog WHERE code = '$oprator'");
  23.             $data_services_pulsa = mysqli_fetch_assoc($check_services_pulsa);
  24.         if(mysqli_num_rows($check_services_pulsa) > 0) {
  25.             echo "Code Sudah Ada Di database => $oprator \n <br />";
  26.         } else {
  27.            
  28. $insert=mysqli_query($db, "INSERT INTO service_dog (name, code, type) VALUES ('$oprator', '$oprator', '$tipe')");//Memasukan Kepada Database (OPTIONAL)
  29. if($insert == TRUE){
  30. echo"SUKSES INSERT -> Nama : $oprator || Oprator : $oprator <br />";
  31. }else{
  32.     echo "GAGAL MEMASUKAN DATA";
  33.    
  34. }
  35. }
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment