Advertisement
Guest User

php_bom_pendidikan

a guest
May 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2. $url = 'http://jendela.data.kemdikbud.go.id/api/index.php/Csekolah/detailSekolahGET?mst_kode_wilayah=010100&bentuk=sd';
  3. $curl = curl_init($url);
  4.  
  5. // Returns the data/output as a string instead of raw data
  6. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($curl, CURLOPT_URL, $url);
  8. curl_setopt($curl, CURLOPT_HTTPHEADER, ['Accept:application/json']);
  9.  
  10. $data = curl_exec($curl);
  11. curl_close($curl);
  12. // Deal with BOM, refer to
  13. // https://stackoverflow.com/questions/689185/json-decode-returns-null-after-webservice-call
  14. $data = substr($data, 3);
  15.  
  16. $res = json_decode($data);
  17. print_r($res);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement