Answer the question
In order to leave comments, you need to log in
API EXMO, new rules?
Hello! The devils
from exmo, as they usually bring gifts, this time, touched on a non-public
API
.
curl -X POST \
https://api.exmo.com/v1/order_create/ \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Key: K-xxx' \
-H 'Sign: xxx' \
-d 'nonce=100500&pair=BTC_USD&type=buy&quantity=0.01&price=5000'
function api_query($api_name = "excode_load", array $req = array())
{
$mt = explode(' ', microtime());
$NONCE = $mt[1] . substr($mt[0], 2, 6);
// API settings
$key = "K-"; //TODO replace with your api key from profile page
$secret = "S-"; //TODO replace with your api secret from profile page
$excode = "";
$url = "http://api.exmo.com/v1/$api_name?code=$excode";
$req['nonce'] = $NONCE;
// generate the POST data string
$post_data = http_build_query($req, '', '&');
$sign = hash_hmac('sha512', $post_data, $secret);
// generate the extra headers
$headers = array(
'Sign: ' . $sign,
'Key: ' . $key,
);
// our curl handle (initialize if required)
static $ch = null;
if (is_null($ch)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')');
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// run the query
$res = curl_exec($ch);
if ($res === false) throw new Exception('Could not get reply: ' . curl_error($ch));
$dec = json_decode($res, true);
if ($dec === null)
throw new Exception('Invalid data received, please make sure connection is working and requested API exists');
return $dec;
}
Answer the question
In order to leave comments, you need to log in
вместо
$url = "http://api.exmo.com/v1/$api_name?code=$excode";
$req['nonce'] = $NONCE;
$url = "http://api.exmo.com/v1/$api_name/";
$req['nonce'] = $NONCE;
$req['code'] = $excode;
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Sign: ' . $sign,
'Key: ' . $key,
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question