PHP code example of resnext / spotoption-api-client

1. Go to this page and download the library: Download resnext/spotoption-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/ */

    

resnext / spotoption-api-client example snippets


$apiClient = new SpotOption\ApiClient(<URL>, <USERNAME>, <PASSWORD>);

$httpClient = new GuzzleHttp\Client([
   GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 2,
]);

$apiClient = new \SpotOption\ApiClient(<API_URL>, <API_USERNAME>, <API_PASSWORD>, [
    'httpClient' => $httpClient,
]);

/** @var \SpotOption\Responses\GetCountriesResponse $response */
$response = $this->apiClient->getCountries();
/** @var \SpotOption\Entities\Country[] $countries */
$countries = $response->getData();

/** @var \SpotOption\Responses\GetCampaigns $response */
$response = $this->apiClient->getCampaigns(\SpotOption\Entities\Campaign::TYPE_CPA);
/** @var \SpotOption\Entities\Campaign[] $countries */
$countries = $response->getData();

/** @var \SpotOption\Responses\ValidateCustomerResponse
$response = $apiClient->validateCustomer('[email protected]', 'password');