当前位置:网站首页>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
边栏推荐
- What is low code development?
- 码农版隐秘的角落:作为开发者最讨厌的5件
- 90后开始攒钱植发,又一个IPO来了
- 解决el-input输入框.number数字输入问题,去掉type=“number“后面箭头问题也可以用这种方法代替
- DataKit——真正的统一可观测性 Agent
- Perfectly integrated into win11 style, Microsoft's new onedrive client is the first to see
- Flask lightweight web framework
- 动态规划股票问题对比
- 一加10 Pro和iPhone 13怎么选?
- Rainfall warning broadcast automatic data platform bwii broadcast warning monitor
猜你喜欢

Cocoscreator event dispatch use

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.

防火墙基础透明模式部署和双机热备

VB cannot access database stocks

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

Wuzhicms code audit

Easy to use map visualization

整理混乱的头文件,我用include what you use

Zhijieyun - meta universe comprehensive solution service provider

Ble HCI flow control mechanism
随机推荐
简单易用的地图可视化
Hidden corners of coder Edition: five things that developers hate most
【HCIA持续更新】广域网技术
The 18th IET AC / DC transmission International Conference (acdc2022) was successfully held online
Using win10 scheduling task program to automatically run jar package at fixed time
新享科技发布小程序UniPro小优 满足客户移动办公场景
【每日一题】556. 下一个更大元素 III
wuzhicms代码审计
高中物理:力、物体和平衡
【系统分析师之路】第七章 复盘系统设计(结构化开发方法)
The Block:USDD增长势头强劲
Cocoscreator event dispatch use
To sort out messy header files, I use include what you use
码农版隐秘的角落:作为开发者最讨厌的5件
Solve the El input input box For number number input problem, this method can also be used to replace the problem of removing the arrow after type= "number"
什么是低代码开发?
Perfectly integrated into win11 style, Microsoft's new onedrive client is the first to see
一加10 Pro和iPhone 13怎么选?
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
DataKit——真正的统一可观测性 Agent