它们的区别,我看到的有如下几点:
1.curl是libcurl这个库支持的,wget是一个纯粹的命令行命令。
2.curl支持更多的协议。curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP and RTSP at the time of this writing.

  Wget supports HTTP, HTTPS and FTP.
3.curl 默认支持HTTP1.1(也支持1.0),

  而wget仅仅支持HTTP1.0规范。引用wget的man page中的一段话吧,Please be aware that Wget needs to know the size of the POST data in advance. It's not quite clear how to work around this limitation inherent in HTTP/1.0. Although HTTP/1.1 introduces chunked transfer that doesn't require knowing the request length in advance, a client can't use chunked unless it knows it's talking to an HTTP/1.1 server.  And it can't know that until it receives a response, which in turn requires the request to have been completed -- a chicken-and-egg problem.
4.curl在指定要下载的链接时能够支持URL的序列或集合,而wget则不能这样;
5.wget支持递归下载,而curl则没有这个功能。(这是wget的一个主要好处,wget也是有优势的,呵呵)

对比可参照:http://daniel.haxx.se/docs/curl-vs-wget.html

多线程下载可以使用axel和mwget



1、wget 递归下载及替换URL

wget -r -p -np -k http://docs.saltstack.cn/zh_CN/latest/topics/tutorials/index.html


2、使用 Curl 测试cookie来记录session信息

像IE/FF这样的浏览器,当然可以轻易处理cookie信息,但curl呢?
option: -D 参数是用来存cookie

$curl -D cookie0001.txt http://www.php-oa.com
这样,当页面被存到page.html的同时,cookie信息也被存到了cookie0001.txt里面了
那么,下一次访问的时候,如何继续使用上次留下的cookie信息呢?要知道,高级防盗链在很多网站都是靠监视你的cookie信息,来判断你是不是不按规矩访问他们的网站的.
这次我们使用这个option来把上次的cookie信息追加到http request里面去: -b

$curl -D cookie0002.txt -b cookie0001.txt http://www.php-oa.com
这样,我们就可以几乎模拟所有的IE操作,去访问网页了!、


3、Curl 来控制是浏览器信息
在CDN的缓存服务器中,我们要看给的浏览器是什么类型,可以用curl给我们提供了一个有用的option,可以让我们随意指定自己这次访问所宣称的自己的浏览器信息: -A

$curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" http://www.php-oa.com
这样,服务器端接到访问的要求,会认为你是一个运行在Windows 2000上的IE6.0

4、 Curl 来控制 Referer
另外一个缓存服务器端常用的限制方法,就是检查http访问的referer.比如你先访问首页,再访问里面所指定的下载页,这第二次访问的referer地址就是第一次访问成功后的页面地址.这样,服务器端只要发现对下载页面某次访问的referer地址不 是首页的地址,就可以断定那是个盗连了~~~~~
curl给我们提供了设定referer的option: -e

$curl -e "http://mail.php-oa.com" http://www.php-oa.com
这样,就可以骗对方的服务器,你是从mail.php-oa.com点击某个链接过来的了,呵呵呵


5、 Curl 多线程下载和断点续传的测试
在缓存服务器中可以控制req_header Range的参数,我们怎么用curl来控制啦.
比如我们下载aaa.jpg中,突然掉线了,我们就可以这样开始续传

$curl -c -O http://www.php-oa.com/aaa.jpg

6、多线程分片下载,:

$curl -r 0-10240 -o "zhao.part1" http:/cgi2.tky.3web.ne.jp/~zzh/zhao1.mp3