curl命令

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章