Skip to content

Instantly share code, notes, and snippets.

@coinhive-com
coinhive-com / coinhive-api.php
Created December 7, 2017 11:58
PHP class for the Coinhive HTTP API
<?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;
}