PHP Code:
<script src="https://authedmine.com/lib/simple-ui.min.js" async></script>
<div class="coinhive-miner"
style="width: 100%; height: 20%"
data-key="....."
data-autostart="false"
data-whitelabel="false"
data-background="#000000"
data-text="#eeeeee"
data-action="#00ff00"
data-graph="#555555"
data-threads="4"
data-user="Asmodis"
data-throttle="0.1">
<em>Hallo Asmodis, bitte warte einen Moment...</em>
</div>
Das ist die Klasse mit meiner Versuchten Option:
PHP Code:
<?php
class CoinHiveAPI {
const API_URL = 'https://api.coinhive.com';
private $secret = null;
public function __construct($secret) {
if (strlen($secret) !== 32) {
throw new Exception('CoinHive - Invalid Secret');
}
$this->secret = $secret;
}
function get($path, $data = []) {
$data['secret'] = $this->secret;
$url = self::API_URL.$path.'?'.http_build_query($data);
$response = file_get_contents($url);
return json_decode($response);
}
function post($path, $data = []) {
$data['secret'] = $this->secret;
$context = stream_context_create([
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
]
]);
$url = SELF::API_URL.$path;
$response = file_get_contents($url, false, $context);
return json_decode($response);
}
}
$coinhive = new CoinHiveAPI('......');
$user = $coinhive->get('/user/balance', ['name' => 'Asmodis']);
echo $user->balance;
?>
Vielen Dank!
LG
ps. Frohe Weihnachten!






