PHP语言对接抖音快手小红书视频/图片去水印API接口源码
以下为PHP语言调用去水印接口的示例,分别展示GET请求方式和POST请求方式的调用方式。示例代码中用到的userId和secretKey请前往开发者接口管理中心获取。
接口文档:https://jx.henghengmao.com/page/apidoc
GET请求方式调用接口示例:
$url = 'https://v.douyin.com/JjEFdHT/'; //请把此处的userId和secretKey换成你自己的 这是GET请求方式 $api = 'https://api.henghengmao.com/video?userId=C81E728D9DC2F636F06CC14862C&secretKey=eac9587cb785c2dd70cd07e116c&url=' . urlencode($url); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $api); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //这个是重点 $data = curl_exec($curl); curl_close($curl); $arrdata = json_decode($data,true); //返回的是json print_r($arrdata);
POST请求方式调用接口示例:
$api = "https://api.henghengmao.com/video"; //视频提取接口 $userId = "C81E728D9DC2F636F06CC14862C"; //这里改成你自己的 userId $secretKey = "eac9587cb785c2dd70cd07e116c"; //这里改成你自己的 secretKey //参数 $url = "https://vt.tiktok.com/rDHxU3/"; function file_get_contents_post($url, $post) { $options = array( "http"=> array( "method"=>"POST", "header" => "Content-type: application/x-www-form-urlencoded", "content"=> http_build_query($post) ), ); $result = file_get_contents($url,false, stream_context_create($options)); return $result; } $param = array("url" => $url, "userId" => $userId, "secretKey" => $secretKey); $data = file_get_contents_post($api, $param); var_dump($data);
总结
相关推荐
83911535 2020-11-13
曾是土木人 2020-10-31
yegen00 2020-10-21
soralaro 2020-10-11
katanaFlower 2020-09-18
wytzsjzly 2020-08-17
88407710 2020-08-17
CyborgLin 2020-08-15
Blueberry 2020-08-15
PinkBean 2020-08-11
katanaFlower 2020-08-03
hunningtu 2020-07-30
阿债的方寸天地 2020-06-28
pingyan 2020-06-25
wytzsjzly 2020-06-25
阳光岛主 2020-06-25
阿债的方寸天地 2020-06-16
阳光岛主 2020-06-14