博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
curl命令详解
阅读量:4231 次
发布时间:2019-05-26

本文共 591 字,大约阅读时间需要 1 分钟。

curl用来请求 Web 服务器。顾名思义就是客户端(client)的 URL 工具的意思。

 

1.不带有任何参数时,curl 就是发出 GET 请求。

curl  http://www.baidu.com

-A   (--user-agent)参数指定客户端的用户代理标头,即User-Agent

curl 的默认用户代理字符串是curl/[version]

-e (--referer)用来设置 HTTP 的标头Referer,表示请求的来源。

-i  打印出服务器回应的 HTTP 标头

-I  向服务器发出 HEAD 请求,然会将服务器返回的 HTTP 标头打印出来。

-o 将服务器的回应保存成文件,等同于wget命令。

curl -o example.html https://www.example.com

上面命令将www.example.com保存成example.html

-O 将服务器回应保存成文件,并将 URL 的最后部分当作文件名。

-v 输出通信的整个过程,用于调试。

-x 指定 HTTP 请求的代理。

curl -x james:cats@myproxy.com:8080 https://www.example.com

-X 指定 HTTP 请求的方法

$ curl -X POST https://www.example.com

未完待续.......

 

 

 

转载地址:http://neiqi.baihongyu.com/

你可能感兴趣的文章
Using Samba
查看>>
XML Security
查看>>
Rails Cookbook
查看>>
Dynamic HTML: The Definitive Reference (Dynamic Html) [ILLUSTRATED]
查看>>
Python (Visual QuickStart Guide)
查看>>
SCJP Sun Certified Programmer for Java 5 Study Guide
查看>>
Building the Perfect PC [ILLUSTRATED]
查看>>
Pro .NET 2.0 Windows Forms and Custom Controls in VB 2005
查看>>
The Definitive Guide to Berkeley DB XML
查看>>
The Concordance Database Manual (Expert's Voice)
查看>>
Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional
查看>>
Expert Service-Oriented Architecture in C# 2005, Second Edition
查看>>
Beginning SharePoint with Excel: From Novice to Professional
查看>>
eBay Business All-in-One Desk Reference For Dummies (For Dummies (Business & Personal Finance))
查看>>
Beginning Java Objects: From Concepts To Code, Second Edition
查看>>
Quality of Service Control in High-Speed Networks
查看>>
OFDM Wireless LANs: A Theoretical and Practical Guide
查看>>
Computer Science Handbook, Second Edition
查看>>
TCP/IP Analysis and Troubleshooting (Spiral-bound)
查看>>
Designing Embedded Hardware [ILLUSTRATED]
查看>>