PHP code example of tiup / tiupsdk

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

    

tiup / tiupsdk example snippets


$options = array(
	'auth_host' => 'https://test.tiup.cn/',
	'api_host' => 'https://test.tiup.cn/',
	'client_id' => 'client_id',
	'client_secret' => 'client_secret'
	);
$tiup = new Tiup\Tiup($options);

$url = $tiup->getAuthorizationUrl('http://localhost/callback.php');
echo '<a target="_blank" href="'.$url.'">使用TiUP账号登录</a>';


$token = $tiup->getAccessToken();
$user = $tiup->me($token);