PHP code example of thinkbim / huichuan-php-sdk

1. Go to this page and download the library: Download thinkbim/huichuan-php-sdk 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/ */

    

thinkbim / huichuan-php-sdk example snippets



#新增配置文件 config/huichuan.php

return [
    'header' => [
        'username' => '账户名称',
        'password' => '账户密码',
        'token' => '授权token',
        'target' => '代理商下的子账户',
        'source' => '请求api来源'
    ],
    'logPath' => 'Log记录目录',
    'filePath' => '报表下载目录'
];




use ThinkBIM\UCSDK\HCClient;

try {
   $client = new HCClient(['target' => '代理商账户名称']);
   $result = $client->account->getAccount();
   if(isset($result['header']['status']) && $result['header']['status'] == 0) {
        //接口请求成功
    }else{
        //接口失败处理
    }
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
    // Guzzle工具请求异常
}

bash
composer