PHP code example of promopult / tiktok-marketing-api

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

    

promopult / tiktok-marketing-api example snippets


$credentials = \Promopult\TikTokMarketingApi\Credentials::fromAccessToken(
    getenv('__ACCESS_TOKEN__')
);

// Any PSR-18 HTTP-client
$httpClient = new \GuzzleHttp\Client();

$client = new \Promopult\TikTokMarketingApi\Client(
    $credentials,
    $httpClient
);

$response = $client->user->info();

print_r($response);

//Array
//(
//    [message] => OK
//    [code] => 0
//    [data] => Array
//        (
//            [create_time] => 1614175583
//            [display_name] => my_user
//            [id] => xxx
//            [email] => xxx
//        )
//
//    [request_id] => xxx
//)