Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
80
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 GRATIS tidak di Perjual Belikan
  4. */
  5. require_once("config.php");//koneksi kepada database
  6. $key = ""; // your api key
  7. $postdata = "api_key=$key";
  8.  
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_URL, "https://irvankede-smm.co.id/api/service");
  11. curl_setopt($ch, CURLOPT_POST, 1);
  12. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  14. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  15. $chresult = curl_exec($ch);
  16. //echo $chresult;
  17. curl_close($ch);
  18. $json_result = json_decode($chresult, true);
  19. $indeks=0;
  20. $i = 1;
  21. // get data service
  22. while($indeks < count($json_result['data'])){
  23.  
  24. $category=$json_result['data'][$indeks]['category'];
  25. $id =$json_result['data'][$indeks]['id'];
  26. $service = $json_result['data'][$indeks]['name'];
  27. $min_order =$json_result['data'][$indeks]['min'];
  28. $max_order = $json_result['data'][$indeks]['max'];
  29. $price = $json_result['data'][$indeks]['price'];
  30. $note = $json_result['data'][$indeks]['notes'];
  31. $indeks++;
  32. $i++;
  33. // end get data service
  34. // setting price
  35. $rate = $price;
  36. $rate_asli = $rate + 100; //setting penambahan harga
  37. // setting price
  38. $check_services_pulsa = mysqli_query($db, "SELECT * FROM services WHERE pid = '$id' AND provider='IRV'");
  39. $data_services_pulsa = mysqli_fetch_assoc($check_orders);
  40. if(mysqli_num_rows($check_services_pulsa) > 0) {
  41. echo "Service Sudah Ada Di database => $service | $id \n <br />";
  42. } else {
  43.  
  44. $insert=mysqli_query($db, "INSERT INTO services (sid,category,service,note, min, max, price, status, pid, provider) VALUES ('$id','$category','$service','$note','$min_order','$max_order','$rate_asli','Active','$id','IRV')");//Memasukan Kepada Database (OPTIONAL)
  45. if($insert == TRUE){
  46. echo"SUKSES INSERT -> Kategori : $category || SID : $id || Service :$service || Min :$min_order || Max : $max_order ||Price : $rate_asli || Note : $note <br />";
  47. }else{
  48. echo "GAGAL MEMASUKAN DATA";
  49.  
  50. }
  51. }
  52. }
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement