coinhive-example/api.php

19 lines
552 B
PHP
Raw Normal View History

2017-10-06 19:32:01 +02:00
<?php
$secret = "dp42NR7L7S3ZyxfhfIkTe98bEw0rzv9C";
$response = array();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 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);