Skip to content

NabiKAZ/Coinex-API-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coinex API PHP

Coinex digital coin exchange API for PHP

Requirements

  • PHP>=5.4
  • CURL PHP module

Install

composer require NabiKAZ/Coinex-API-PHP dev-main

Acquire access_id and secret_key

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

Setup request

<?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);

Set proxy

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);

Set params

//params if nedded
//IMPORTANT: no needed set access_id, tonce into params.
$params = [
];

Arguments of request

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 (Method 1)

//send request
$coinex->url = $url;
$coinex->params = $params;
$coinex->method = $method;
$res = $coinex->send();

Send request (Method 2)

//send request
$res = $coinex->send($url, $params, $method);

See results

//see results
var_dump($res);

Examples

You can see more examples in the examples.php file.

Wiki

See all requests, params and responses in here official wiki.

About

Coinex exchange API for PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages