参考API文档示例的PHP代码如下:
require_once __DIR__ . '/lib/YZGetTokenClient.php';
require_once __DIR__ . '/lib/YZTokenClient.php';
$client_id = "应用client_id"; //请填入有赞云控制台的应用client_id
$client_secret = "应用client_secret"; //请填入有赞云控制台的应用client_secret
$token_client = new YZGetTokenClient( $client_id , $client_secret );
$type = 'self';
$keys['kdt_id'] = '店铺ID'; // 店铺ID
$token_data = $token_client->get_token( $type , $keys );
$client = new YZTokenClient($token_data['access_token']);
$method = 'youzan.scrm.customer.search'; //要调用的api名称
$api_version = '3.1.0'; //要调用的api版本号
$my_params = [
'is_member' => '0',
];
$my_files = [
];
var_dump(
$client->post($method, $api_version, $my_params, $my_files)
);
运行结果:
Fatal error: Uncaught exception 'Exception' with message 'response invalid, data: ' in /Users/youzan/lib/YZTokenClient.php:36
Stack trace:
#0 /Users/youzan/lib/YZTokenClient.php(22): YZTokenClient->parse_response(false)
#1 /Users/youzan/customer_search.php(24): YZTokenClient->post('youzan.scrm.cus...', '3.1.0', Array, Array)
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|