PHP code example of zmoyi / jstan
1. Go to this page and download the library: Download zmoyi/jstan 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/ */
zmoyi / jstan example snippets
private array $config = [
// 授权地址
'authUrl' => 'https://openweb.jushuitan.com/auth',
// 接口地址
'baseUrl' => 'https://dev-api.jushuitan.com/',
// 授权接口地址
'apiUrl' => 'https://openapi.jushuitan.com/',
// 授权token
'accessToken' => 'b7e3b1e24e174593af8ca5c397e53dad',
// 应用key
'appKey' => 'b0b7d1db226d4216a3d58df9ffa2dde5',
// 应用secret
'appSecret' => '99c4cef262f34ca882975a7064de0b87',
// 版本号
'version' => '2',
// 时间戳
'timestamp' => time(),
// 字符集
'charset' => 'utf-8',
// 是否验证证书
'verify' => false,
// 超时时间
'timeout' => 0,
// 强制覆盖GuzzleHttp请求参数
'httpClientConfig' => [
// 'proxy' => 'http://username:[email protected] :10'
],
];
use JsTan\Client;
use JsTan\Route;
/****/
$client = Client::getInstance($this->config);
$route = Route::getInstance();
//路由可使用 Route::QUERY_SHOPS || $route->getRoute('QUERY_SHOPS') || 'open/logisticscompany/query'
// 常量传入,getRoute 传入,字符串传入,看自己喜好
/**
* 查询门店列表(请求示例)
*/
$response = $client->request($route->getRoute('QUERY_SHOPS'), [
'page_index' => 1,
'page_size' => 10
]);
/**
* 获取access_token (请求示例)
*/
$response = $client->getAccessToken('001');
/**
* 刷新access_token (请求示例)
*/
$response = $client->refreshToken('001');
print_r($response);