Coinhive User Balance auslesen

12/26/2017 02:24 Bitace#1
Hallo habe heute mal mit Coinhive rumprobiert und den Miner eingefügt:
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> 
Nun möchte ich von diesem User die Balance auslesen und habe die PHP Klasse von denen Verwendet jedoch bekomme ich eine weise Seite :(
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($urlfalse$context);
        return 
json_decode($response);
    }    
}

$coinhive = new CoinHiveAPI('......');

$user $coinhive->get('/user/balance', ['name' => 'Asmodis']);
echo 
$user->balance;

?>
Kann eventuell jemand ein Beispiel Posten wie ich von diesem es Anzeigen lassen kann?

Vielen Dank!
LG

ps. Frohe Weihnachten!
12/26/2017 03:01 algernong#2
In der php.ini die Option "display_errors" auf true setzen. Um den Pfad zur php.ini zu ermitteln, erstell ein Skript indem du phpinfo() aufrufst und ruf das im Browser auf, da steht der Pfad dann irgendwo.

Danach nochmal dein Skript ausführen und die Fehlermeldung posten.
12/26/2017 11:14 Bitace#3
Vielen Dank für die Antwort! Also er spuckt nun folgendes aus:
PHP Code:
Parse errorsyntax errorunexpected '<'expecting end of file in /data/web/e78124/html/mining/info.php on line 33 
€dit: Habe die Kommentare gelöscht, und es funktioniert einwandfrei danke dir :)