PHP code example of masnathan / aliexpress-affiliate-php

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

    

masnathan / aliexpress-affiliate-php example snippets




$client = new \MASNathan\AliExpress\Client(12345);
$aliExpress = new MASNathan\AliExpress\AliExpress($client);

$request = new \MASNathan\AliExpress\Request\ListPromotionProductRequest();

$request
    ->setFields([
        'totalResults',
        'productId',
        'productTitle',
        'productUrl',
        'imageUrl',
        'originalPrice',
        'salePrice',
        //'discount',
        'evaluateScore',
        'commission',
        'commissionRate',
        '30daysCommission',
        'volume',
        'packageType',
        'lotNum',
        'validTime',
        'localPrice',
        //'allImageUrls',
    ])
    ->setKeywords('spinner')
    ->setPageSize(1)
    ->setHighQualityItems(true);

$result = $aliExpress->request($request);

dump($result['products'][0]);