PHP code example of dml / easytbk

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

    

dml / easytbk example snippets



use Dml\EasyTBK\Factory;
use Dml\EasyTBK\TaoBao\Request\TbkItemInfoGetRequest;

$client = Factory::taobao([
    'app_key' => 'TAOBAO_APP_KEY',
    'app_secret' => 'TAOBAO_APP_SECRET',
    'format' => 'json'
]);
$req = new TbkItemInfoGetRequest;
$req->setNumIids('$numIids');
return $client->execute ($req);


use Dml\EasyTBK\Factory;
use Dml\EasyTBK\JingDong\Request\JdUnionGoodsPromotiongoodsinfoQueryRequest;

$jd = Factory::jingdong([
    'app_key' => 'JD_APP_KEY',
    'app_secret' => 'JD_APP_SECRET',
    'format' => 'json',
]);
$req = new JdUnionGoodsPromotiongoodsinfoQueryRequest();
$req->setSkuIds('$itemid');
return $jd->execute($req);


use Dml\EasyTBK\Factory;
use Dml\EasyTBK\PinDuoDuo\Request\DdkGoodsDetailRequest;

$pdd = Factory::pinduoduo([
    'client_id' => 'PDD_CLIENT_ID',
    'client_secret' => 'PDD_CLIENT_SECRET',
    'format' => 'json',
]);
$req = new DdkGoodsDetailRequest();
$req->setGoodsIdList('[$itemid]');
return  $pdd->execute($req);


use Dml\EasyTBK\Factory;
use Dml\EasyTBK\Vip\Request\PidGenRequest;
use Dml\EasyTBK\Vip\Request\UnionPidServiceClient;

// 唯品会官方的sdk写的比较垃圾,用法和其他平台稍微不一样
$service= UnionPidServiceClient::getService();
Factory::vip([
    'app_key' => 'VIP_APP_KEY',
    'app_secret' => 'VIP_APP_SECRET',
    'access_token' => 'VIP_APP_ACCESS_TOKEN',
    'format' => 'json',
]);
$pidGenRequest1 = new PidGenRequest();
$pidNameList2 = array();
$pidNameList2[0] = "value";
$pidGenRequest1->pidNameList = $pidNameList2;
$pidGenRequest1->requestId = "requestId";
print_r($service->genPidWithOauth($pidGenRequest1));


use Dml\EasyTBK\Factory;
use Dml\EasyTBK\SuNing\Request\Netalliance\CouponproductQueryRequest;

$c = Factory::suning([
    'app_key' => 'SUNING_APP_KEY',
    'app_secret' => 'SUNING_APP_SECRET',
    'format' => 'json',
]);
$req = new CouponproductQueryRequest();
$req->setPageNo("1");
$req->setPageSize("10");
$req->setPositionId("12");
$resp = $c->execute($req);
print_r($resp);