android 中调试http 获取数据 (使用curl )

1.请求一个网络资源
curl https://www.google.com.hk


2.在输出中显示HTTP header,同时也包含网页的源代码
curl -i http://www.google.cn


3. 显示一个通信过程,显示从curl发到服务器端的header,以及返回的header信息
curl -v http://g.cn


4. 下载文件,并设置自动保存。
curl -o /Picture/123.jpg http://xxx.xxx.123.jpg

无参数,保存文件至根目录
curl -O http://xxx.xxx.123.jpg



5.下载多个文件
curl {URL1,URL2,URL3} -o file1 -o file2 -o file3


7.get 请求调试
curl "CURL?id=1&page=2"  注意如果没有“”,则会只取到第一个参数\\

with JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" URL

with XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X URL



8.post 请求调试

For posting data:
curl --data "param1=value1&m2=value2" http://hostname/resource


For file upload:
curl --form "fileupload=@filename.txt" http://hostname/resource

RESTful HTTP Post:
curl -X POST -d @filename http://hostname/resource


9. 使用制定的User-Agent请求一个网络地址
curl -H "User-Agent:123" URL


10.使用指定的header访问网络地址
curl  -H "Content-Type:application/json" -H "Accept:application/json1" URL







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值