当前位置:网站首页>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
边栏推荐
- R语言plotly可视化:plotly可视化互相重叠的直方图(historgram)、并在直方图的顶部边缘使用geom_rug函数添加边缘轴须图Marginal rug plots
- Recast of recastnavigation
- 超大规模数仓集群在大型商业银行的落地实践
- Heartless sword Chinese translation of Elizabeth Bishop's a skill
- [proteus simulation] printf debugging output example based on VSM serial port
- Vscode modification indentation failed, indent four spaces as soon as it is saved
- 【HCIA持续更新】广域网技术
- [unity ugui] scrollrect dynamically scales the grid size and automatically locates the middle grid
- 解决el-input输入框.number数字输入问题,去掉type=“number“后面箭头问题也可以用这种方法代替
- Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding
猜你喜欢
《吐血整理》保姆级系列教程-玩转Fiddler抓包教程(2)-初识Fiddler让你理性认识一下
![[HCIA continuous update] overview of WLAN workflow](/img/0a/b3986307589a9f7379fe1dd707b9f8.png)
[HCIA continuous update] overview of WLAN workflow

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

上网成瘾改变大脑结构:语言功能受影响,让人话都说不利索

【HCIA持续更新】WLAN概述与基本概念

Easy to use map visualization

Developers, MySQL column finish, help you easily from installation to entry

要上市的威马,依然给不了百度信心

How to choose one plus 10 pro and iPhone 13?

超标量处理器设计 姚永斌 第5章 指令集体系 摘录
随机推荐
Recast of recastnavigation
tx.origin安全问题总结
To sort out messy header files, I use include what you use
新享科技发布小程序UniPro小优 满足客户移动办公场景
关于nacos启动时防火墙开启8848的坑
Display opencv drawn pictures on MFC picture control control
What is low code development?
国产数据库TiDB初体验:简单易用,快速上手
长城证券安全不 证券开户
如何进行MDM的产品测试
【每日一题】556. 下一个更大元素 III
“在越南,钱就像躺在街上”
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
通过事件绑定实现动画效果
78岁华科教授冲击IPO,丰年资本有望斩获数十倍回报
Is it safe for Great Wall Securities to open an account? How to open a securities account
Easy to use map visualization
整理混乱的头文件,我用include what you use
电子宠物小狗-内部结构是什么?