以下為PHP語言調用去水印接口的示例,分別展示GET請求方式和POST請求方式的調用方式。示例代碼中用到的userId和secretKey請前往開發者接口管理中心獲取。
接口文檔:https://jx.henghengmao.com/page/apidoc
GET請求方式調用接口示例:
1
2
3
4
5
6
7
8
9
10
11
12
|
$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請求方式調用接口示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
$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 ); |
總結
到此這篇關于PHP語言對接抖音快手小紅書視頻/圖片去水印API接口源碼的文章就介紹到這了,更多相關PHP對接抖音快手小紅書視頻內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!
原文鏈接:https://www.cnblogs.com/QaOp/archive/2020/08/11/php_curl_api.html