PHP代码调用接口示例
接口文档:单个帖子(视频/图集)提取接口 主页批量提取接口
以下为PHP语言调用提取接口的示例。示例代码中用到的userId和secretKey请前往开发者接口管理中心获取。
$api = "https://h.aaaapp.cn/single_post"; # 单个帖子提取接口 (如果主页批量提取使用:https://h.aaaapp.cn/posts)
$userId = "C81E728D9DC2F636F06CC14862C"; //这里改成你自己的 userId
$secretKey = "eac9587cb785c2dd70cd07e116c"; //这里改成你自己的 secretKey
//参数
$url = "https://www.tiktok.com/@nike/video/7198345395863309611";
$params = array("url" => $url, "userId" => $userId, "secretKey" => $secretKey);
$options = array(
"http" => array(
"header" => "Content-type: application/json",
"method" => "POST",
"content" => json_encode($params),
),
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
$result = file_get_contents($api,false, stream_context_create($options));
var_dump($result);