Coinex digital coin exchange API for PHP
- PHP>=5.4
- CURL PHP module
composer require NabiKAZ/Coinex-API-PHP dev-main
Sign in to CoinEx before invoking API and get Acquire access_id/secret_key in Account > API.
access_id: To mark identity of API invoker
secret_key: Key to sign the request parameters
<?php
require __DIR__ . '/vendor/autoload.php';
use NabiKAZ\Coinex\CoinexAPI;
//use this variable in some functions as global
$access_id = '<ACCESS_ID>';
$secret_key = '<SECRET_KEY';
//create api object
$coinex = new CoinexAPI($access_id, $secret_key);
The proxy is optional.
Use proxy URL with this format:
scheme://[username:password@]hostname:port
For examples:
$proxy = 'socks5://user:pass@localhost:12345';
$proxy = 'http://127.0.01:8080';
And so use this proxy when setup request:
$coinex = new CoinexAPI($access_id, $secret_key, $proxy);
//params if nedded
//IMPORTANT: no needed set access_id, tonce into params.
$params = [
];
name | type | required | default | example | description |
---|---|---|---|---|---|
$url |
string | yes | - | 'market/ticker' |
The request URL |
$params |
array | no | [] |
['market'=>'BCHBTC'] |
The request parameters |
$method |
string | no | 'get' |
'get', 'post', 'delete' |
The request method |
//send request
$coinex->url = $url;
$coinex->params = $params;
$coinex->method = $method;
$res = $coinex->send();
//send request
$res = $coinex->send($url, $params, $method);
//see results
var_dump($res);
You can see more examples in the examples.php
file.
See all requests, params and responses in here official wiki.