PHP code example of stallzhan / tiktok-php-sdk-unofficial
1. Go to this page and download the library: Download stallzhan/tiktok-php-sdk-unofficial 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/ */
stallzhan / tiktok-php-sdk-unofficial example snippets
// include your composer dependencies
nt();
$client->setClientKey("xxx");
$client->setClientSecret("xxx");
$client->setScopes([
"user.info.basic",
"video.upload"
]);
$client->setState("xxx");
$client->setRedirectUri("xxx");
$authUrl = $client->createAuthUrl();
header("Location: $authUrl");
if ($_GET['code']) {
$data = $client->fetchAccessTokenWithAuthCode($_GET['code']);
$client->setCredentials($data);
}
} catch (Exception $e) {
var_dump($e->getMessage());
}
$client->setCredentials($data);
$server = new \Tiktok\Service($client);
$userinfo = $server->userinfo_v2->get();
$data = $client->refreshToken();