PHP code example of alexander-emelyanov / tradesmarter-api-client

1. Go to this page and download the library: Download alexander-emelyanov/tradesmarter-api-client 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/ */

    

alexander-emelyanov / tradesmarter-api-client example snippets


$client = new \TradeSmarter\ApiClient("https://<username>:<password>@<hostname>");

/** @var \TradeSmarter\Responses\Country[] $countries */
$countries = $client->countries();

$request = new TradeSmarter\Requests\Register([
    'firstName' => 'John',
    'lastName' => 'Smith',
    'email' => '[email protected]',
    'confirmed' => 1,
    'password' => 'qwerty',
    'phone' => '+123456789',
    'country' => 'gb',
    'locale' => 'en-GB',
    'params' => [],
    'lead' => 0,
]);

/** @var \TradeSmarter\Responses\Register $response */
$response = $client->register($request);

$request = new \TradeSmarter\Requests\Login([
    'email' => '[email protected]',
    'password' => 'qwerty',
]);

/** @var \TradeSmarter\Responses\Login $response */
$response = $client->login($request);

$request = new \TradeSmarter\Requests\Login([
    'email' => '[email protected]',
    'password' => 'qwerty',
]);

/** @var \TradeSmarter\Responses\UserInfo $response */
$response = $client->getUserInfo($request);