• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

同步Lazada店铺商品

开发技术 开发技术 1周前 (05-04) 11次浏览
PHP文件头:
import('lazada.LazopSdk', EXTEND_PATH);
use LazopClient;
use LazopRequest;
use function GuzzleHttpjson_decode;
use function GuzzleHttpjson_encode;
header("Content-Type:text/html; charset=utf8");

Lazada开发者平台地址:https://open.lazada.com/doc/api.htm?spm=a2o9m.11193494.0.0.78eb266blhSWzQ#/api?cid=5&path=/product/create

获得店铺的商品:

switch ($country) {
    case 'Thailand':
        $url = 'https://api.lazada.co.th/rest';
        break;
    case 'Malaysia':
        $url = 'https://api.lazada.com.my/rest';
        break;
    case 'Vietnam':
        $url = 'https://api.lazada.vn/rest';
        break;
    case 'Indonesia':
        $url = 'https://api.lazada.co.id/rest';
        break;
    case 'Philippines':
        $url = 'https://api.lazada.com.ph/rest';
        break;
    case 'Singapore':
        $url = 'https://api.lazada.sg/rest';
        break;
    default:
        $url = '';
        break;
}
# 获取商品——lazada平台
$c = new LazopClient($url, $appkey, $appSecret);
$request = new LazopRequest('/products/get', 'GET');
$request->addApiParam('filter', 'live');//见文档
$request->addApiParam('offset', 0);//见文档
$request->addApiParam('limit', 1);//见文档
$result = json_decode($c->execute($request, $accessToken), true);
$total_products = $result['data']['total_products'];//产品总数
$products_list = $result['data']['products'];//产品列表

  

  


程序员灯塔
转载请注明原文链接:同步Lazada店铺商品
喜欢 (0)