当前位置:网站首页>Clever use of curl command
Clever use of curl command
2022-07-04 17:50:00 【Wu_ Candy】
curl Introduce :
curl Is based on URL Syntax is a file transfer tool that works on the command line , It supports FTP,FTPS,HTTP,HTTPS,GOPHER,TELNET,DICT,FILE And LDAP Such agreement .curl Support HTTPS authentication , And support HTTP Of POST,PUT Other methods ,FTP Upload ,kerberos authentication ,HTTP Upload , proxy server ,cookies, user name / Password authentication , adopt http The proxy server uploads files to FTP Servers and so on , Very powerful . This article mainly shares some common scenarios :
curl Common parameters :
-I Display request header information only
-d HTTP POST Way to transmit data , With json Format
-o Write the output to this file
-s silent mode . Don't export anything
-X What order to give , Such as GET POST
-v Check the details
-u Set the user and password of the server
-H The custom request header to be sent to the server
-w What to output when finished
-b Read from file cookie Information
-F Upload files
-# Show progress bar
No 1:curl Command send get request
Example :curl -X GET http://www.xxx.com/search?data=123
No 2:curl Command send get Count the time consumption of each stage after the request
curl -o /dev/null -s -w "time_namelookup:%{time_namelookup}\ntime_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" www.xxx.com
No 3:curl Command send post request
curl www.xxx.com/api/openservice/query/queryProperty -H "Content-Type:application/json" -X POST -d '{"baseCondition": {"propertyId": 1, "dateRange": {"fromDate": "2019-07-04", "toDate": "2019-07-05"}, "adults": 1,"children": 0, "rooms": 1, "channelId": 2, "sellCategories": ["PUBLIC", "NEGOTIATE"]},"extensionCondition": {"rateIds": [], "unableFlag":"False", "currency": "CNY"}, "context": {}}'
No 4:curl Command send post Count the time consumption of each stage after the request
curl -o /dev/null -s -w "time_namelookup:%{time_namelookup}\ntime_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" www.xxx.com/api/openservice/query/queryProperty -H "Content-Type:application/json" -X POST -d '{"baseCondition": {"propertyId": 1, "dateRange": {"fromDate": "2019-07-04", "toDate": "2019-07-05"}, "adults": 1,"children": 0, "rooms": 1, "channelId": 2, "sellCategories": ["PUBLIC", "NEGOTIATE"]},"extensionCondition": {"rateIds": [], "unableFlag":"False", "currency": "CNY"}, "context": {}}'
No 5:curl Command to save the file locally
curl -o file.html http://www.xxx.com/index.html
No 6:curl Command login service
curl -u name:passwd http://www.xxx.com
No 7:curl Command constructs a request header
curl -H "Content-Type:application/json" http://www.xxx.com
No 8:curl Command reads from the file cookie Information
curl -b "cookie.txt" http://www.xxx.com
No 9:curl Command upload file
curl -b "cookie.txt" -F "[email protected]/temp/a.txt" http://www.xxx.com/api/upload -v
No 10:curl Command to download the file and display the download progress
curl -# -o abc.jpg http://www.xxx.com/abc.JPG
No 11:curl Order clear es The data in it
curl -XDELETE http://10.8.102.102:9200/entity-beta-ars6_ars-reservation -uadmin:admin # clear ES
边栏推荐
- shell脚本的替换功能实现
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- 长城证券开户安全吗 证券账户怎么开通
- Using win10 scheduling task program to automatically run jar package at fixed time
- What is low code development?
- La 18e Conférence internationale de l'IET sur le transport d'électricité en courant alternatif et en courant continu (acdc2022) s'est tenue avec succès en ligne.
- Internet addiction changes brain structure: language function is affected, making people unable to speak neatly
- 【Proteus仿真】基于VSM 串口printf调试输出示例
- 补能的争议路线:快充会走向大一统吗?
- Wuzhicms code audit
猜你喜欢

PingCode 性能测试之负载测试实践

简单易用的地图可视化

数学分析_笔记_第7章:多元函数的微分学

Interpretation of data security governance capability evaluation framework 2.0, the fourth batch of DSG evaluation collection

Zebras are recognized as dogs, and the reason for AI's mistakes is found by Stanford

解决el-input输入框.number数字输入问题,去掉type=“number“后面箭头问题也可以用这种方法代替

To sort out messy header files, I use include what you use

NFT流动性市场安全问题频发—NFT交易平台Quixotic被黑事件分析

To sort out messy header files, I use include what you use

为啥有些线上演唱会总是怪怪的?
随机推荐
简单易用的地图可视化
R language plot visualization: plot visualization of multiple variable violin plot in R with plot
居家打工年入800多万,一共五份全职工作,他还有时间打游戏
Introduction of time related knowledge in kernel
Electronic pet dog - what is the internal structure?
解决el-input输入框.number数字输入问题,去掉type=“number“后面箭头问题也可以用这种方法代替
Performance test of Gatling
【系统分析师之路】第七章 复盘系统设计(结构化开发方法)
Pytorch深度学习之环境搭建
[proteus simulation] printf debugging output example based on VSM serial port
What grade does Anxin securities belong to? Is it safe to open an account
[Huawei HCIA continuous update] SDN and FVC
Pytoch deep learning environment construction
Flask 轻量web框架
雨量预警广播自动化数据平台BWII 型广播预警监测仪
CocosCreator事件派发使用
电子宠物小狗-内部结构是什么?
shell脚本的替换功能实现
DataKit——真正的统一可观测性 Agent
开发者,MySQL专栏完更,助你轻松从安装到入门进阶