PHP code example of doubler / tiktok-open-api

1. Go to this page and download the library: Download doubler/tiktok-open-api 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/ */

    

doubler / tiktok-open-api example snippets


use Doubler\OpenApiSdk\Client;
use Doubler\TiktokOpenApi\Context;
use Doubler\TiktokOpenApi\Authorization\GetTokenRequestBuilder;

$client = new Client();

$context = new Context([
    'service_id' => '',
    'app_key' => '',
    'app_secret' => '',
    
    // default locale
    'locale' => 'en-US',

    'access_token' => '',
    'refresh_token' => '',
    'shop_cipher' => '',
]);

// get authorization uri.
echo $context->getAuthorizationUri();

// build request
$builder = new GetTokenRequestBuilder($context);
$builder->setAuthCode('authCode');
$request = $builder->getRequest();

// send request and get response.
$response = $client->send($request);

php examples/GetCategories.php