PHP code example of zkeysteam / openapi-sdk-php

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

    

zkeysteam / openapi-sdk-php example snippets


use Zkeys\OpenApi\Auth;
use Zkeys\OpenApi\options\AuthOption;

$authOption = new AuthOption();
$authOption->setSecretId('NuDbL3WsJzfFZR8y');// 设置Secret Id
$authOption->setSecretKey('JvPuOlre5ZjA61x8hCyTP2zYvfJnKaRL');// 设置Secret Key
$auth = new Auth();

$result = $auth->getToken($authOption);

if (!$result) {
    echo $auth->getError();
}

var_export($result);// 正常返回结果: array ( 'access_token' => '43a759e123477bc9ecbaa7b58ee6fa70', 'expires_in' => 7200 )