日期:2014-05-16  浏览次数:20581 次

Linux CURL常用功能

1、从FTP下载文件

# curl -u username:password -O ftp://ip/file

? % Total ? ?% Received % Xferd ?Average Speed ? Time ? ?Time ? ? Time ?Current

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Dload ?Upload ? Total ? Spent ? ?Left ?Speed

100 37986 ?100 37986 ? ?0 ? ? 0 ?27854 ? ? ?0 ?0:00:01 ?0:00:01 --:--:-- 29561

?

2、读取访问一个URL的Header头信息

# curl -I http://www.jjwxc.net

HTTP/1.1 200 OK

Content-Type: text/html

Vary: Accept-encoding

Accept-Ranges: bytes

Content-Encoding: gzip

Last-Modified: Tue, 05 Feb 2013 17:19:15 GMT

Content-Length: 11495

Date: Wed, 06 Feb 2013 03:46:30 GMT

X-Cache: HIT from CU-86-SH-JJCDN

X-Cache-Lookup: HIT from CU-86-SH-JJCDN:80

Age: 10375

PowerCDN: HIT from tj6.powercdn.com

Via: 1.1 tj6.powercdn.com (PowerCDN/2.4)

Connection: close

?

3、伪造来源地址,有的网站会判断,请求来源地址

# curl -e http://www.baidu.com http://www.jjwxc.net