PHP code example of yaaqiu / php-alibabasdk
1. Go to this page and download the library: Download yaaqiu/php-alibabasdk 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/ */
yaaqiu / php-alibabasdk example snippets
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();
}
shell
$ composer