yaaqiu/php-alibabasdk

1688开放平台 接口sdk

1.0.0 2022-10-25 15:10 UTC

This package is auto-updated.

Last update: 2024-11-30 01:43:19 UTC


README

安装

运行环境要求PHP7.1+

$ composer require yaaqiu/php-alibabasdk

快速使用

<?php

use alibabasdk\AlibabaOauth;
use alibabasdk\AlibabaClient;
use alibabasdk\AlibabaException;

// 授权获取access_token
$data = new AlibabaOauth('your appKey','your appSecret','your redirectUri');

// 接口调用
$params = [
   'page'     => 1,
   'pageSize' => 20
];

$client = new AlibabaClient('your appKey', 'your appSecret', 'your accessToken');

$api = 'com.alibaba.p4p:alibaba.cps.op.searchCybOffers-1';

try {
   $client->post($api,$params); // post
   $client->get($api,$params);  // get
}catch (AlibabaException $e){
   echo $e->getMessage();
}