curl post
来源:互联网 发布:电驴端口设置 编辑:程序博客网 时间:2024/04/30 12:52
接口测试是访问post方法
1、代码请求
<?php $arr = array( // 'ChannelId' => 20100330, 'SecretId' => 111, 'Name' => '西藏', 'StartTime' => '1473192900', 'EndTime' => '1473192960', 'Description' => "好吗好的", 'PlayMode' => 1, 'Definitions' => 'cif|cd|sd', 'IsRecord' => 1, 'IsAudio' => 1, ); //1.初始化,创建一个新cURL资源 $ch = curl_init(); //2.设置URL和相应的选项 curl_setopt($ch, CURLOPT_URL, "http://172.16.208.9/interface"); curl_setopt($ch, CURLOPT_HEADER, 0);//curl_setopt($ch, CURLOPT_HEADER, false); // 设置请求为post类型 curl_setopt($ch, CURLOPT_POST, 1);//如果把这行注释掉的话,就会直接输出 // 添加post数据到请求中 curl_setopt($ch, CURLOPT_POSTFIELDS, $arr); // echo " 11";die; //3.抓取URL并把它传递给浏览器 $response= curl_exec($ch); //4.关闭cURL资源,并且释放系统资源 curl_close($ch); // return $response;
$arr : 请求是传给post的数据
http://172.16.208.9/interface :访问post请求的地址
2、命令请求
# POST curl -u username --data "param1=value1&m2=value" https://api.github.com // 用户名nginx post请求数据 访问的接口执行成功后
0 0
- curl post...
- curl post
- curl post
- curl post
- curl post and get
- PHP CURL POST提交
- CURL HTTPS POST
- PHP CURL HTTPS POST
- Linux curl post data
- curl POST demo
- PHP CURL HTTPS POST
- PHP CURL HTTPS POST
- curl with post json
- CURL模拟POST/GET
- CURL POST json字符串
- cURL模拟POST请求
- cURL-GET/POST/上传
- 用Curl测试POST
- css清浮动方法
- 在浏览器上打开本地应用
- FushionChart一个酷炫的图表插件
- 使用Myelipse逆向生成类图的步骤
- 建议147:重构多个相关属性为一个类
- curl post
- MySQL server has gone away 问题的解决方法(查询的结果集超过 max_allowed_packet )
- Token验证
- 自定义控件三部曲之动画篇(三)—— 代码生成alpha、scale、translate、rotate、set及插值器动画
- Android学习之ListView的优化01
- pat 乙 1012. 数字分类
- 编程箴言
- Thymeleaf教程 (五) Thymeleaf标准表达式语法(下)
- 建议148:不重复代码