diamondpedia

Untitled

Jun 27th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <?php
  2. require_once("config.php");
  3.  
  4. $postdata = "api_key=hGNRcF2VMaEXCicIDpZrdczrj";
  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. $id = $json_result[$indeks][id];
  19. $name = $json_result[$indeks][name];
  20. $status = $json_result[$indeks][status];
  21. $price = $json_result[$indeks][price];
  22. $oprator = $json_result[$indeks][oprator];
  23. $indeks++;
  24.  
  25. $check_services_pulsa = mysqli_query($conn, "SELECT * FROM layanan_pulsa WHERE kode = '$layanan'");
  26. $data_services_pulsa = mysqli_fetch_assoc($check_services_pulsa);
  27. if(mysqli_num_rows($check_services_pulsa) > 0) {
  28. echo "Code Sudah Ada Di database => $oprator \n <br />";
  29. } else {
  30.  
  31. $nomor = $no++;
  32. $insert_service = mysqli_query($conn, "INSERT INTO layanan_pulsa VALUES ('','$nomor','$id','$operator','$name','$price','100','$status', 'DPEDIA')");
  33. if($insert_service == TRUE){
  34. echo"SUKSES INSERT -> Nama : $oprator || Oprator : $oprator <br />";
  35. }else{
  36. echo "GAGAL MEMASUKAN DATA";
  37.  
  38. }
  39. }
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment