当前位置:网站首页>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
边栏推荐
- kaili不能输入中文怎么办???
- gatling 之性能测试
- leetcode:421. The maximum XOR value of two numbers in the array
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- [test development] software testing - Basics
- OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首
- R语言plotly可视化:plotly可视化互相重叠的直方图(historgram)、并在直方图的顶部边缘使用geom_rug函数添加边缘轴须图Marginal rug plots
- I2C子系统之适配器的设备接口分析(i2c-dev.c文件分析)
- 曾经的“彩电大王”,退市前卖猪肉
- What are cache penetration, cache breakdown, and cache avalanche
猜你喜欢

一文掌握数仓中auto analyze的使用

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"
《吐血整理》保姆级系列教程-玩转Fiddler抓包教程(2)-初识Fiddler让你理性认识一下

电子宠物小狗-内部结构是什么?

【HCIA持续更新】WLAN工作流程概述

为啥有些线上演唱会总是怪怪的?

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

上市公司改名,科学还是玄学?

Electronic pet dog - what is the internal structure?

OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首
随机推荐
KS007基于JSP实现人个人博客系统
Internet addiction changes brain structure: language function is affected, making people unable to speak neatly
【HCIA持续更新】广域网技术
VSCode修改缩进不成功,一保存就缩进四个空格
Vscode modification indentation failed, indent four spaces as soon as it is saved
解读数据安全治理能力评估框架2.0,第四批DSG评估征集中
[HCIA continuous update] WLAN overview and basic concepts
【HCIA持续更新】WLAN概述与基本概念
To sort out messy header files, I use include what you use
Introduction of time related knowledge in kernel
[HCIA continuous update] overview of WLAN workflow
超大规模数仓集群在大型商业银行的落地实践
Zhijieyun - meta universe comprehensive solution service provider
图像检索(image retrieval)
Talk about seven ways to realize asynchronous programming
[Huawei HCIA continuous update] SDN and FVC
【华为HCIA持续更新】SDN与FVC
Ble HCI flow control mechanism
为啥有些线上演唱会总是怪怪的?
Using win10 scheduling task program to automatically run jar package at fixed time