做一些视频小程序都会用到的接口php源码

比如小程序解析接口请求方式调用接口示例:

$url = ‘https://v.douyin.com/2Jfw4Mo/’;

//请把此处的uid和token换成你自己的 这是GET请求方式

a p i = h t t p s : / / e e a p i . c n / a p i / v i d e o / 32886 D D 5 A 6 A 23 C 9 D 8 E 6 B 9 C 2 A F D C 9 C 2 D C 6 C 1 A B F 7 F B C 6 E 2 E F 9 C 4 / 57 / ? u r l = ′ . u r l e n c o d e ( api = https://eeapi.cn/api/video/32886DD5A6A23C9D8E6B9C2AFDC9C2DC6C1ABF7FBC6E2EF9C4/57/?url='. urlencode( api=https://eeapi.cn/api/video/32886DD5A6A23C9D8E6B9C2AFDC9C2DC6C1ABF7FBC6E2EF9C4/57/?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); //这个是重点

d a t a = c u r l e x e c ( data = curl_exec( data=curlexec(curl);

curl_close($curl);

a r r d a t a = j s o n d e c o d e ( arrdata = json_decode( arrdata=jsondecode(data,true); //返回的是json

print_r($arrdata);

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐