protected static function useRemoteAPI(string $url, string $id): array
{
$response = Http::timeout(30)
->baseUrl(config("services.codespikex.api"))
->withUserAgent(request()->userAgent())
->acceptJson()
->withoutVerifying()
->get('/api/v2/tiktok/get-video', [
'url' => $url,
'id' => $id,
'ip' => request()->ip(),
'license' => config('app.license_key'),
'domain' => config('app.url'),
]);
if ($response->failed()) {
throw new TikTokAPIException(
$response->json('message', "Failed to connect to TikTok API."),
$response->json('code', 500),
$response->status()
);
}
return $response->json();
}