1. Go to this page and download the library: Download cfxmarkets/php-exchange-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cfxmarkets / php-exchange-sdk example snippets
// In your code, where you're planning on using the SDK...
$cfx = new \CFX\SDK\Exchange\Client('https://sandbox.apis.cfxtrading.com/exchange', $apiKey, $secret, $httpClient);
// Get a list of assets from the server
$assets = $cfx->assets->get();
$asset = $assets[0];
echo $asset->getName();
// ...
// First, create some peripherals
$asset = $cfx->assets->create(['id' => $_POST['assetSymbol']]);
$qty = $_POST['qty'];
// Then create the order locally (assume that $user is a valid user in your system)
$order = $cfx->orders->create()
->setType('sell')
->setOwnerToken($user->getToken())
->setAsset($asset)
->setQuantity($qty);
// Now, send the order to the server, catching any errors thrown
try {
$order->save();
$response = ....
} catch (\CFX\BadInputException $e) {
// Means there were data input errors
} catch (.....) {
// etc...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.