1, CURLOPT_URL => 'https://api.coinhive.com/user/top?secret='.$secret.'&count=10' )); $result = curl_exec($curl); $json = json_decode($result,true); foreach($json['users'] as $i => $values){ $username = htmlentities($values['name']); $response[$values['name']] = htmlentities($values['total']); } header('Content-Type: application/json'); echo json_encode($response); curl_close($curl);