diamondpedia

get produk dpedia

Sep 14th, 2019
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1. ----------------------------------------------------------
  2.                                                        
  3.             SCRIPT GET PRODUK PULSA DPEDIA              
  4.         Bagus Adetyo Nugroho < [email protected]  
  5.                     Diamond Group                                                        
  6. ----------------------------------------------------------
  7. <?php
  8. require_once("mainconfig.php");
  9. $postdata = "api_key=APIKEYLO";
  10. $untung = "100";   // SET untung ( mark up ) dari DPEDIA
  11.  
  12. $ch = curl_init();
  13. curl_setopt($ch, CURLOPT_URL, "https://serverh2h.net/service/pulsa");
  14. curl_setopt($ch, CURLOPT_POST, 1);
  15. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  17. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  18. $chresult = curl_exec($ch);
  19. echo $chresult;
  20. curl_close($ch);
  21. $json_result = json_decode($chresult, true);
  22. $indeks=0;
  23. while($indeks < count($json_result)){
  24. $id = $json_result[$indeks][id];
  25. $name = $json_result[$indeks][name];
  26. $status = $json_result[$indeks][status];
  27. $price = $json_result[$indeks][price]+ $untung;
  28. $oprator = $json_result[$indeks][oprator];
  29. $type = $json_result[$indeks][tipe];
  30. $indeks++;
  31.  
  32. mysqli_query($db,"INSERT INTO services_pulsa (id, pid, name, oprator, tipe, price, status, keterangan, provider) VALUES ('$id', '$id', '$name', '$oprator', '$type', '$price', '$status', 'Masukan No HP dengan benar', 'DPEDIA')");
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment