curl模拟http发送get或post接口测试
一、get请求
curl "http://www.baidu.com" 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
curl -i "http://www.baidu.com" 显示全部信息
curl -l "http://www.baidu.com" 只显示头部信息
curl -v "http://www.baidu.com" 显示get请求全过程解析
wget "http://www.baidu.com"也可以
二、post请求
curl -d "param1=value1¶m2=value2" "http://www.baidu.com"
三、json格式的post请求
curl -l -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' http://domain/apis/users.json
例如:
curl -l -H "Content-type: application/json" -X POST -d '{"ver": "1.0","soa":{"req":"123"},"iface":"me.ele.lpdinfra.prediction.service.PredictionService","method":"restaurant_make_order_time","args":{"arg2":"\"stable\"","arg1":"{\"code\":[\"WIND\"],\"temperature\":11.11}","arg0":"{\"tracking_id\":\"100000000331770936\",\"eleme_order_id\":\"100000000331770936\",\"platform_id\":\"4\",\"restaurant_id\":\"482571\",\"dish_num\":1,\"dish_info\":[{\"entity_id\":142547763,\"quantity\":1,\"category_id\":1,\"dish_name\":\"[0xe7][0x89][0xb9][0xe4][0xbb][0xb7][0xe8][0x85][0x8a][0xe5][0x91][0xb3][0xe5][0x8f][0x89][0xe7][0x83][0xa7][0xe5][0x8f][0x8c][0xe6][0x8b][0xbc][0xe7][0x85][0xb2][0xe4][0xbb][0x94][0xe9][0xa5][0xad]\",\"price\":31.0}],\"merchant_location\":{\"longitude\":\"121.47831425\",\"latitude\":\"31.27576153\"},\"customer_location\":{\"longitude\":\"121.47831425\",\"latitude\":\"31.27576153\"},\"created_at\":1477896550,\"confirmed_at\":1477896550,\"dishes_total_price\":0.0,\"food_boxes_total_price\":2.0,\"delivery_total_price\":2.0,\"pay_amount\":35.0,\"city_id\":\"1\"}"}}' http://vpcb-lpdinfra-stream-1.vm.elenet.me:8989/rpc
ps:json串内层参数需要格式化
curl模拟http发送get或post接口测试的更多相关文章
- php使用curl模拟多线程发送请求
每个PHP文件的执行是单线程的,但是php本身也可以用一些别的技术实现多线程并发比如用php-fpm进程,这里用curl模拟多线程发送请求.php的curl多线程是通过不断调用curl_multi_e ...
- [转]php中 curl模拟post发送json并接收json
本文转自:https://blog.csdn.net/pangchengyong0724/article/details/52103962 本地模拟请求服务器数据,请求数据格式为json,服务器返回数 ...
- php中 curl模拟post发送json并接收json(转)
本地模拟请求服务器数据,请求数据格式为json,服务器返回数据也是json. 由于需求特殊性, 如同步客户端的批量数据至云端, 提交至服务器的数据可能是多维数组数据了. 这时需要将此数据以一定的数据 ...
- curl模拟多线程
1.curl发送请求的请求的基本思路 打开会话 设置会话参数 发送请求 关闭句柄 2.curl单进程发送示例 <?php //请求链接 $arr = [ 'https://www.yahoo.c ...
- 使用HttpClient配置代理服务器模拟浏览器发送请求调用接口测试
在调用公司的某个接口时,直接通过浏览器配置代理服务器可以请求到如下数据: 请求url地址:http://wwwnei.xuebusi.com/rd-interface/getsales.jsp?cid ...
- CURL模拟登陆
index.html <a href="http://adtuu-server.com/login/login.php?auth_username=admin&auth_pas ...
- PHP curl 模拟登陆
一个比较好的类: $cookie_file=tempnam("C:/users","tmp");生成以以tmp为前缀的文件. <?php define ( ...
- php curl模拟post请求提交数据样例总结
在php中要模拟post请求数据提交我们会使用到curl函数,以下我来给大家举几个curl模拟post请求提交数据样例有须要的朋友可參考參考.注意:curl函数在php中默认是不被支持的,假设须要使用 ...
- php中curl模拟post提交多维数组(转载)
原文地址:http://www.cnblogs.com/mingaixin/archive/2012/11/09/2763265.html 今天需要用curl模拟post提交参数,请求同事提供的一个接 ...
随机推荐
- Python小笔记
最近在学习Python 以前也学过一些编程语言 但是都不扎实 由于工作的原因 需要学习Python做一些处理 刚开始学习总有多多少少的不适应 从今天开始打算将我在学习中遇到的困难以及疑问记录下来 ...
- SVN入门教程
1. 什么是SVN SVN全名Subversion,即版本控制系统.SVN与CVS一样,是一个跨平台的软件,支持大多数常见的操作系统. 作为一个开源的版本控制系统,Subversion管理者随时间改变 ...
- 【转】Linux tail 命令详解
Linux tail 命令详解 http://www.2cto.com/os/201111/110143.html
- pandas 级联 concat append
连接的一个有用的快捷方式是在Series和DataFrame实例的append方法.这些方法实际上早于concat()方法. 它们沿axis=0连接 #encoding:utf8 import pan ...
- vue render function & dataset
vue render function & dataset https://vuejs.org/v2/guide/render-function.html#The-Data-Object-In ...
- jmeter属性与变量
jmeter属性定义在jmeter.properties 文件中 更多详细说明: Getting Started - Configuring JMeter 属性是全局的,常用来定义一些jmeter使用 ...
- 使用pygal_maps_world.i18n中数据画各大洲地图
源码: # 使用pygal_maps_world.i18n中数据画各大洲地图 from pygal_maps_world.i18n import ASIA from pygal_maps_world ...
- Lodop强制分页LODOP.NewPage()和LODOP.NewPageA()
使用Lodop打印控件打印时,有自动分页,有手动强制分页,也可以两者结合使用,在使用两者结合的时候注意LODOP.NewPage()和LODOP.NewPageA()的区别,如果前面打印项自动分页不止 ...
- face parsing
主页:https://www.sifeiliu.net/project 基于CNN face parsing: https://www.sifeiliu.net/face-parsing codes: ...
- CUBA在查询语句如何添加参数
在browse.xml中的collectionDatasource 可以添加查询语句,使用 “= :custom$param” 的形式 <collectionDatasource id=&qu ...