当前位置:网站首页>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
边栏推荐
- 上网成瘾改变大脑结构:语言功能受影响,让人话都说不利索
- How to test MDM products
- Introduction of time related knowledge in kernel
- 如何进行MDM的产品测试
- Vb无法访问数据库stocks
- How to choose one plus 10 pro and iPhone 13?
- Face_recognition人脸识别之考勤统计
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- CocosCreator事件派发使用
- Pytorch深度学习之环境搭建
猜你喜欢
[test development] software testing - Basics
ble HCI 流控机制
第十八届IET交直流輸電國際會議(ACDC2022)於線上成功舉辦
[unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid
VSCode修改缩进不成功,一保存就缩进四个空格
上市公司改名,科学还是玄学?
Zebras are recognized as dogs, and the reason for AI's mistakes is found by Stanford
居家打工年入800多万,一共五份全职工作,他还有时间打游戏
Talk about seven ways to realize asynchronous programming
Load test practice of pingcode performance test
随机推荐
你应该懂些CI/CD
The top half and bottom half of the interrupt are introduced and the implementation method (tasklet and work queue)
Superscalar processor design yaoyongbin Chapter 6 instruction decoding excerpt
90后开始攒钱植发,又一个IPO来了
Set the transparent hidden taskbar and full screen display of the form
就在今天丨汇丰4位专家齐聚,共讨银行核心系统改造、迁移、重构难题
股价大跌、市值缩水,奈雪推出虚拟股票,深陷擦边球争议
Using win10 scheduling task program to automatically run jar package at fixed time
Pytorch深度学习之环境搭建
Zebras are recognized as dogs, and the reason for AI's mistakes is found by Stanford
Vscode modification indentation failed, indent four spaces as soon as it is saved
《吐血整理》保姆级系列教程-玩转Fiddler抓包教程(2)-初识Fiddler让你理性认识一下
第十八届IET交直流輸電國際會議(ACDC2022)於線上成功舉辦
What if Kaili can't input Chinese???
Performance test of Gatling
[HCIA continuous update] WLAN overview and basic concepts
将Opencv绘制图片显示在MFC Picture Control控件上
What are cache penetration, cache breakdown, and cache avalanche
Detectron2 installation method
Is BigDecimal safe to calculate the amount? Look at these five pits~~