PHP code example of retailcrm / aliexpress-top-client

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

    

retailcrm / aliexpress-top-client example snippets


use RetailCrm\Component\AppData;
use RetailCrm\Factory\TopClientFactory;

$client = TopClientFactory::createClient(
    AppData::OVERSEAS_ENDPOINT,
    'appKey',
    'appSecret',
    'session token here'
);

use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;

$request = new HttpDnsGetRequest();

/** @var \RetailCrm\Model\Response\Taobao\HttpDnsGetResponse $response */
$response = $client->sendRequest(new HttpDnsGetRequest());

use Http\Client\Curl\Client;
use RetailCrm\Component\AppData;
use RetailCrm\Component\Environment;
use Nyholm\Psr7\Factory\Psr17Factory;
use RetailCrm\Builder\TopClientBuilder;
use RetailCrm\Builder\ContainerBuilder;
use RetailCrm\Component\Logger\StdoutLogger;
use RetailCrm\Component\Authenticator\TokenAuthenticator;

$client = new Client();
$logger = new StdoutLogger();
$factory = new Psr17Factory();
$authenticator = new TokenAuthenticator('token');
$appData = new AppData(AppData::OVERSEAS_ENDPOINT, 'appKey', 'appSecret');
$container = ContainerBuilder::create()
            ->setEnv(Environment::TEST)
            ->setClient($client)
            ->setLogger($logger)
            ->setStreamFactory($factory)
            ->setRequestFactory($factory)
            ->setUriFactory($factory)
            ->build();
$client = TopClientBuilder::create()
            ->setContainer($container)
            ->setAppData($appData)
            ->build();

use RetailCrm\Component\AppData;
use RetailCrm\Builder\TopClientBuilder;
use RetailCrm\Builder\ContainerBuilder;
use RetailCrm\Component\Authenticator\TokenAuthenticator;

$appData = new AppData(AppData::OVERSEAS_ENDPOINT, 'appKey', 'appSecret');
$client = TopClientBuilder::create()
            ->setContainer(ContainerBuilder::create()->build())
            ->setAppData($appData)
            ->setAuthenticator(new TokenAuthenticator('session token here'))
            ->build();