PHP code example of ihipop / taobao-top
1. Go to this page and download the library: Download ihipop/taobao-top 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/ */
ihipop / taobao-top example snippets
$application = new \ihipop\TaobaoTop\Application([
'topClient' => [
'apiKey' => '1234567',
'apiSecret' => 'qwerty.',
'secureRandomNum' => 'qawsed', // `如果你应用开启了加密 就设置这个 否则请设置为null`
'autoDecrypt' => true, // `同上 如果你应用开启了加密 需要自动解密 就打开这个 否则请关闭,设置为false`
],
'providers' => [
'http' => \ihipop\TaobaoTop\providers\GuzzleHttpClientServiceProvider::class,
],
]);
$topClient = $application->topClient;
$request = new \ihipop\TaobaoTop\requests\taobao\GetTradesSold();
$request->setFields([
'post_fee',
'receiver_name',
'receiver_state',
'receiver_address',
'receiver_zip',
'receiver_mobile',
'receiver_phone',
'consign_time',
'received_payment',
'receiver_country',
'receiver_town',
'tid',
'num',
'status',
'title',
'type',
'price',//其他字段略
])->setType([
'guarantee_trade',
'auto_delivery',
'ec',
'cod',
'step',
'tmall_i18n',
'nopaid',
])->setUseHasNext('true')->setPageSize(20);
$request->setStartCreated(date('Y-m-d H:i:s', time() - 5 * 60))->setEndCreated(date('Y-m-d H:i:s'));
$response = $topClient->execute($request, $accessToken)
public $encryptedFields = [
'trades.trade' => [
'@' => [//订单1
'receiver_name' => 'name',
'buyer_nick' => 'nick',
'receiver_mobile' => 'mobile',
'receiver_phone' => 'phone',
'service_orders.service_order' => [
'@' => [//服务订单1
'buyer_nick' => 'nick',
],
],
],
],
];
$request = new \ihipop\TaobaoTop\requests\RawTopRequest('alibaba.orp.recommend')