Home > Backend Development > PHP Tutorial > Master the PHP language to connect Douyin Kuaishou Xiaohongshu video/image watermark removal API interface source code

Master the PHP language to connect Douyin Kuaishou Xiaohongshu video/image watermark removal API interface source code

coldplay.xixi
Release: 2023-04-09 13:48:01
forward
5292 people have browsed it

Master the PHP language to connect Douyin Kuaishou Xiaohongshu video/image watermark removal API interface source code

The following is an example of calling the watermark removal interface in PHP language, showing the calling methods of GET request method and POST request method respectively. For the userId and secretKey used in the sample code, please go to the Developer Interface Management Center to obtain them.

GET request method calling interface example:

$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);
Copy after login

POST request method calling interface example:

$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);
Copy after login

Related learning recommendations: php programming( video)

The above is the detailed content of Master the PHP language to connect Douyin Kuaishou Xiaohongshu video/image watermark removal API interface source code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template