Open plogic opened 7 years ago
I am getting this same error. I have not found a solution as of yet either.
It is because of the way nonce is calculated, the api cannot make more than one call per second. The api is already making a call in constructor to get balance, so any other call is failing. Just update constructor to:
public function __construct($priv, $pub) {
$this->privateKey = $priv;
$this->publicKey = $pub;
}
That is already in this https://github.com/KittyCatTech/cryptopia-api-php/blob/master/cryptopiaAPI.php is that what you are taling about?
Yes replace __construct there with above.
I am not sure what you are trying to tell me, That is already there
public function __construct($priv, $pub) { $this->privateKey = $priv; $this->publicKey = $pub; $result = json_decode($this->apiCall("GetBalance", array( 'Currency'=> 'BTC' )), true); // There is a bug in the API if you send no parameters it will return Success:true Error: Market not found. // Array // ( // [Success] => 1 // [Message] => // [Data] => // [Error] => Market not found. // ) // print_r($result); if( $result['Success'] != "true" ) { throw new Exception("Can't Connect to Cryptopia, Error: " . $result['Error'] ); return false; } return true; }
simply replace the whole thing you pasted above with:
public function __construct($priv, $pub) {
$this->privateKey = $priv;
$this->publicKey = $pub;
}
you dont lose anything by deleting unnecessary code.
Thank you for helping me. That worked perfectly!
I really appreciate it!
i'm sorry but i'm a real noob, i don't know what i have to do with the code. What I have to do with exactly?
Dear KittyCatTech,
Although i am a real beginner your code in cryptopia-api-php looked clear to me. But using it will every time come with an "Can't Connect to Cryptopia, Error: ". (No real error is written out.) Does it have something to do with the API problem? You wrote : "There is a bug in the API if you send no parameters it will return Success:true Error: Market not found." How can this be handeld? Did you find a solution already?
With regards, Paul van den Elsaker