Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("config.php");
- $postdata = "api_key=hGNRcF2VMaEXCicIDpZrdczrj";
- $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)){
- $id = $json_result[$indeks][id];
- $name = $json_result[$indeks][name];
- $status = $json_result[$indeks][status];
- $price = $json_result[$indeks][price];
- $oprator = $json_result[$indeks][oprator];
- $indeks++;
- $check_services_pulsa = mysqli_query($conn, "SELECT * FROM layanan_pulsa WHERE kode = '$layanan'");
- $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 {
- $nomor = $no++;
- $insert_service = mysqli_query($conn, "INSERT INTO layanan_pulsa VALUES ('','$nomor','$id','$operator','$name','$price','100','$status', 'DPEDIA')");
- if($insert_service == TRUE){
- echo"SUKSES INSERT -> Nama : $oprator || Oprator : $oprator <br />";
- }else{
- echo "GAGAL MEMASUKAN DATA";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment