Did anyone worked with spectrocoin's API. I am trying to send bitcoins using their API and I'm getting some error.
I've written this php code, when running I'm getting the error [{"code":99,"message":"Please check your request"}] when refreshing the token and [{"code":100,"message":"Unexpected error"}] when sending bitcoins
// auth
$url = 'https://spectrocoin.com/api/r/oauth2/auth';
$ch = curl_init($url);
$jsonData = array(
'client_id' => 'wallet_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'client_secret' => 'xxxxxxxx',
'version' => '1.0',
'scope' => 'send_currency currency_exchange user_account'
);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Connection: Keep-Alive',
'Content-Length: '.strlen($jsonDataEncoded),
'Content-Type: application/json',
'Host: spectrocoin.com'
));
$result = curl_exec($ch);
$manage = explode(":",$result);
$manageB = explode('"',$manage[1]);
$manageC = explode('"',$manage[4]);
$accessToken = $manageB[1];
$refreshToken = $manageC[1];
// refresh
$url = 'https://spectrocoin.com/api/r/oauth2/refresh';
$ch = curl_init($url);
$jsonData = array(
'client_id' => 'wallet_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'client_secret' => 'xxxxxxxx',
'version' => '1.0',
'scoperefresh_token' => $refreshToken
);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Connection: Keep-Alive',
'Content-Length: '.strlen($jsonDataEncoded),
'Content-Type: application/json',
'Host: spectrocoin.com'
));
$result = curl_exec($ch);
echo $result;
// send
$url = 'https://spectrocoin.com/api/r/wallet/send/BTC';
$ch = curl_init($url);
$jsonData = array(
'amount' => '0.00000600',
'receiver' => '1DnWpp7AeM69w14MU5TXWUSERrhWFEtP92'
);
$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$accessToken ,
'Connection: Keep-Alive',
'Content-Length: '.strlen($jsonDataEncoded),
'Content-Type: application/json',
'Host: spectrocoin.com'
));
$result = curl_exec($ch);