curl是一个和服务器交互信息(发送和获取信息)的命令行工具,支持DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET和TFTP等协议。curl支持代理、用户认证、FTP上传、HTTP POST请求、SSL连接、cookies、文件传输、Metalink等功能。
查看响应头
curl -i http://www.baidu.com
查看交互过程
[root@mysql ~]# curl -v www.baidu.com
- About to connect() to www.baidu.com port 80 (#0)
- Trying 61.135.169.121... connected
- Connected to www.baidu.com (61.135.169.121) port 80 (#0)
GET / HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: www.baidu.com
Accept: /
< HTTP/1.1 200 OK
< Server: bfe/1.0.8.18
< Date: Thu, 23 Feb 2017 11:49:04 GMT
< Content-Type: text/html
< Content-Length: 2381
< Last-Modified: Mon, 23 Jan 2017 13:27:29 GMT
< Connection: Keep-Alive
< ETag: "588604c1-94d"
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Pragma: no-cache
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
< Accept-Ranges: bytes`
网友评论