I've tried writing a code to get JSON data from API like this
<?php
$url = "http://api.jakarta.go.id/v1/kota/?format=json";
$ch = curl_init();
$accesstoken = "my_token";
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'Content-type: application/json';
$headr[] = 'Authorization: OAuth '.$accesstoken;
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($ch);
curl_close($ch);
var_dump(json_decode($result, true));
?>
but not working and i get NULL data. please help me :)