php - 我如何使用 php https://www.fembed.com/api#download-video 使用 curl -X POST api
问题描述
我正在尝试使用https://www.fembed.com/api#transfer-video中的这个 api,有人可以详细说明如何使用 php 使用它,我知道如何使用 curl -X POST。
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "links=JSON_ENCODED_ARRAY"
-H "Content-Type: application/x-www-form-urlencoded"```
can someone help me and give me an example please
解决方案
您必须使用 php-curl 进行设置
这里是参数:
用你的数据做这个卷曲:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://url-to-send-post');
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"client_id=ClIENT_ID&client_secret=ClIENT_SECRET&file_id=IdOfVideo&title=NEW_TITLE");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$data = curl_exec($ch);
curl_close($ch);
var_dump($data);//response data
推荐阅读
- java - Guice 模块测试:要求绑定带注释的字符串
- python - Python:TypeError:预期的 str、字节或 os.PathLike 对象,而不是 PdfFileReader
- ios - swift UserDefaults 中缺少登录凭据
- android - 强制正确 onActivityResult 方法调用 - Android
- sql-server - Sql Server 创建动态作业
- javascript - 限制 SharePoint 新表单项上的 Java 附件数?
- javascript - 如何禁用数组和对象的 Chrome JavaScript 控制台重新评估?
- oauth-2.0 - Acumatica 报告创作和单点登录
- javascript - Style.visibility 不隐藏元素
- angular - 茉莉花,业力,正确地嘲笑一个承诺