当前位置:网站首页>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
边栏推荐
- Face_recognition人脸识别之考勤统计
- 【Hot100】32. 最长有效括号
- NFT流动性市场安全问题频发—NFT交易平台Quixotic被黑事件分析
- 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.
- 【Hot100】31. 下一个排列
- R语言plotly可视化:plotly可视化多分类变量小提琴图(multiple variable violin plot in R with plotly)
- 关于nacos启动时防火墙开启8848的坑
- Zhijieyun - meta universe comprehensive solution service provider
- Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
- 【华为HCIA持续更新】SDN与FVC
猜你喜欢

KS007基于JSP实现人个人博客系统

“在越南,钱就像躺在街上”

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

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

简单易用的地图可视化

How to test MDM products

完美融入 Win11 风格,微软全新 OneDrive 客户端抢先看
Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding

码农版隐秘的角落:作为开发者最讨厌的5件

The 18th IET AC / DC transmission International Conference (acdc2022) was successfully held online
随机推荐
设置窗体透明 隐藏任务栏 与全屏显示
Interpretation of data security governance capability evaluation framework 2.0, the fourth batch of DSG evaluation collection
一加10 Pro和iPhone 13怎么选?
我写了一份初学者的学习实践教程!
第十八届IET交直流輸電國際會議(ACDC2022)於線上成功舉辦
【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子
What is low code development?
Cocoscreator event dispatch use
What if Kaili can't input Chinese???
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"
[Huawei HCIA continuous update] SDN and FVC
Device interface analysis of the adapter of I2C subsystem (I2C dev.c file analysis)
Face_recognition人脸识别之考勤统计
估值900亿,超级芯片IPO来了
Set the transparent hidden taskbar and full screen display of the form
整理混乱的头文件,我用include what you use
【华为HCIA持续更新】SDN与FVC
电子宠物小狗-内部结构是什么?
居家打工年入800多万,一共五份全职工作,他还有时间打游戏
leetcode:421. The maximum XOR value of two numbers in the array