2017 © Pedro Peláez
 

library aliexapi

AliExpress Affiliate API PHP Library

image

clchangnet/aliexapi

AliExpress Affiliate API PHP Library

  • Sunday, April 17, 2016
  • by allanchangcl
  • Repository
  • 14 Watchers
  • 60 Stars
  • 1,596 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 35 Forks
  • 4 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

THIS WILL NOT WORK WITH THE UPDATED ALIEXPRESS API, TAOBAO OPEN PLATFORM API

aliexapi

Build Status Latest Stable Version Total Downloads License, (*1)

AliexApi is a PHP library for AliExpress Affiliate API program. You can use it to fetch product data. It interfaces with Aliexpress API functions such as listPromotionProduct, getPromotionProductDetail and getPromotionLinks. For more info on the API, visit http://portals.aliexpress.com/help/help_center_API.html. To see a working demo site, goto clothes, warmers and headwear., (*2)

This Library based on Jan Eichhorn's Amazon Product Advertising API., (*3)

If you like this package, feel free to buy me a coffee ☕️, (*4)

AliExpress Affiliate Program

To signup and join the program, goto http://portals.aliexpress.com/, you need to apply for API Key to get access., (*5)

Installation

Composer

Add the package 'clchangnet/aliexapi' to composer.json file:, (*6)

{
    "require": {
        "clchangnet/aliexapi": "~1.0"
    }
}

Update composer of the new package and download. Once done, you should see a folder 'clchangnet' under 'vendor' folder., (*7)

$ composer update
$ composer install

This will update the autoloader file and the library would be found once you include it in your code., (*8)

Basic Usage:

Here is an example how to use Aliexpress API listPromotionProduct to search for products using keywords., (*9)

Search Products

Note: To search by category. uncomment 'categoryId' and comment 'keywords' in searchItems and listPromotionProduct, (*10)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;

use AliexApi\Configuration\GenericConfiguration;
use AliexApi\AliexIO;
use AliexApi\Operations\ListProducts;

class AliapiController extends Controller
{
    public function aliconfig($conf)
    {
        $conf
            ->setApiKey('ALI_API_KEY')
            ->setTrackingKey('ALI_TRACKING_ID')
            ->setDigitalSign('ALI_DIGITAL_SIGNATURE');
            return $conf;
    }

    public function index()
    {
        $this->searchItems();
    }

    public function searchItems()
    {
        $lppfields = [
            // 'categoryId' => '1501',
            'keywords' => 'baby shoes',
            ];
        $array = $this->listPromotionProduct($lppfields);
        dd($array);
    }

    public function listPromotionProduct($lppfields)
    {
        $conf = new GenericConfiguration();
        $this->aliconfig($conf);
        $aliexIO = new AliexIO($conf);

        $listproducts = new ListProducts();
        $listproducts->setFields('productId,productTitle,productUrl,imageUrl');
        $listproducts->setKeywords($lppfields['keywords']);
        // $listproducts->setCategoryId($lppfields['categoryId']);
        $listproducts->setHighQualityItems('true');

        $formattedResponse = $aliexIO->runOperation($listproducts);
        $array = json_decode($formattedResponse, true);

        $array = array_merge($array, $lppfields);

        return $array;

    }
}

    public function getPromotionLinks()
    {
        $conf = new GenericConfiguration();
        $this->aliconfig($conf);
        $aliexIO = new AliexIO($conf);

        $listproducts = new GetLinks();
        $listproducts->setFields('url,promotionUrl');
        $listproducts->setTrackingId('ALI_TRACKING_ID');
        $listproducts->setUrls('http://url1, http://url2');

        $formattedResponse = $aliexIO->runOperation($listproducts);
        $array = json_decode($formattedResponse, true);
        return $array;
    }

Example Workflow: Use ListProducts to search using keywords and set what fields to return. Use GetLinksTo convert product urls to your affiliate link., (*11)

Webservice Documentation:

To find out about what fields can be return through API request, goto http://portals.aliexpress.com/help/help_center_API.html, (*12)

The Versions

17/04 2016

dev-master

9999999-dev https://github.com/clchangnet/aliexapi

AliExpress Affiliate API PHP Library

  Sources   Download

Apache-2.0

The Development Requires

by Allan Chang

rest soap product advertising aliexpress affiliate products

17/04 2016

1.1.0

1.1.0.0 https://github.com/clchangnet/aliexapi

AliExpress Affiliate API PHP Library

  Sources   Download

Apache-2.0

The Development Requires

by Allan Chang

rest soap product advertising aliexpress affiliate products

02/04 2016

1.0.0

1.0.0.0 https://github.com/clchangnet/aliexapi

AliExpress Affilate API PHP Library

  Sources   Download

Apache-2.0

The Development Requires

by Allan Chang

rest soap product advertising aliexpress affiliate products