1.curl基本用法,将返回的html文件内容显示在屏幕上
curl http://www.baidu.com/
2.curl下载文件
curl -O localhost:80/complexmaze.html
注意是大写O,将文件下载到当前目录,且文件名不变
curl -o /root/aa.txt localhost:80/complexmaze.html
注意是小写o,将文件下载到指定目录,可自定义文件名
3.curl测试网页返回值
curl -o /dev/null -s -w %{http_code} www.baidu.com
-s表示静默模式,不会输出统计信息
http_code表示请求的返回码
http_code也可使用以下值进行替换:
content_type,
filename_effective,
ftp_entry_path
http_connect
http_version
local_ip
local_port
num_connects
num_redirects
proxy_ssl_verify_result
redirect_url
redirect_url
remote_ip
remote_port
…………