PHP code example of affiliateforge / php-admitad-api

1. Go to this page and download the library: Download affiliateforge/php-admitad-api 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/ */

    

affiliateforge / php-admitad-api example snippets


$api = new \Affiliateforge\PhpAdmitadApi\APIClient();

$clientID = '777xyz'; 
$authHash = 'XE5NVl0bU5NcQ==';
$scopes = ['coupons'];

$getTokenCmd = new \Affiliateforge\PhpAdmitadApi\Api\Endpoints\ClientAuthorization\GetToken($clientID, $scopes);
$getTokenResponse = $api->doRequest($getTokenCmd, [
    'Authorization' => 'Basic ' . $authHash,
]);

$headers = [
    'Authorization' => 'Bearer ' . $getTokenResponse->getAccessToken(),
];
$couponsCmd = new \Affiliateforge\PhpAdmitadApi\Api\Endpoints\Coupons\GetList(limit: 1);
$couponsResponse = $api->doRequest($couponsCmd, $headers);

var_dump($couponsResponse->getResults());