PHP code example of wangchengtao / tianque

1. Go to this page and download the library: Download wangchengtao/tianque 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/ */

    

wangchengtao / tianque example snippets



use Summer\TianQue\Kernel\AopClient;
use Summer\TianQue\Kernel\AopFactory;
use Summer\TianQue\Kernel\Config;

$config = new Config(
    'https://openapi-test.tianquetech.com',
    'your orgId',
    'your privateKey',
    '天阙平台公钥',
);

$client = new AopClient($config);

// or get client by factory
//$config = [
//    'domain' => 'https://openapi-test.tianquetech.com',
//    'org_id' => 'your orgId',
//    'private_key' => 'your privateKey',
//    'public_key' => '天阙平台公钥',
//];
//$client = AopFactory::client($config);

$request = new UploadRequest();
$request->setOrgId($config->getOrgId());
$request->setPictureType(86);
$request->setFile('http://gips1.baidu.com/it/u=3874647369,3220417986&fm=3028&app=3028&f=JPEG&fmt=auto?w=720&h=1280');

$res = $client->upload($request);