Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("mainconfig.php");
- $postdata = "api_key=MASUKAN-API-KEY-DISINI";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://serverh2h.net/service/pulsa");
- 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;
- while($indeks < count($json_result)){
- $oprator = $json_result[$indeks][oprator];
- $tipe = $json_result[$indeks][tipe];
- $indeks++;
- $check_services_pulsa = mysqli_query($db, "SELECT * FROM service_dog WHERE code = '$oprator'");
- $data_services_pulsa = mysqli_fetch_assoc($check_services_pulsa);
- if(mysqli_num_rows($check_services_pulsa) > 0) {
- echo "Code Sudah Ada Di database => $oprator \n <br />";
- } else {
- $insert=mysqli_query($db, "INSERT INTO service_dog (name, code, type) VALUES ('$oprator', '$oprator', '$tipe')");//Memasukan Kepada Database (OPTIONAL)
- if($insert == TRUE){
- echo"SUKSES INSERT -> Nama : $oprator || Oprator : $oprator <br />";
- }else{
- echo "GAGAL MEMASUKAN DATA";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment