PHP code example of atgames / ads-php

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

    

atgames / ads-php example snippets






\Ads\Ads::setApiKey('OTEwMDA6a1I2UkFTelJhUS1lcWNZSkw1blE=');
$data = \Ads\Product::all();
echo $data;

// set up your tweaked Curl client
$curl = new \Ads\HttpClient\CurlClient();
$curl->setTimeout(10); // default is \Ads\HttpClient\CurlClient::DEFAULT_TIMEOUT
$curl->setConnectTimeout(5); // default is \Ads\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT

echo $curl->getTimeout(); // 10
echo $curl->getConnectTimeout(); // 5

// tell Ads to use the tweaked client
\Ads\ApiRequestor::setHttpClient($curl);

// use the Ads API client as you normally would
bash
composer 
bash
./vendor/bin/phpunit tests/UtilTest.php