curl

它是用来在linux命令行里边去访问web、访问一个网页、访问一个网站或是去下载一个文件。


[root@wy ~]# curl www.aming.linux

说明:这个看到的是一个html的源代码


-I 可以省略源代码,看它的状态码

[root@wy ~]# curl -I www.aming.linux

HTTP/1.1 200 OK

Server: nginx/1.10.1

Date: Mon, 03 Oct 2016 08:57:35 GMT

Content-Type: text/html; charset=UTF-8

Connection: keep-alive

Vary: Accept-Encoding

X-Powered-By: PHP/5.6.22


常见状态码:200(成功),301(域名跳转),302,404,403,502,503


-x代理

WEBRESOURCE9b30e2d76d134e92ccbe034164422


查看访问过程-v

[root@wy ~]# curl -Iv http://www.baidu.com


需要输入用户名密码去访问站点

格式:

[root@wy ~]# curl -u username:password http://www.baidu.com


下载一个文件-O

WEBRESOURCE045ea2c2fc8fcc38558bfbe90ba6a


-o则是重命名一下

WEBRESOURCEa0d02851a50c3e3f267af58cd4bd5