<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[跟着ArthurXF学FreeBSD26——wget用法详解]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[FreeBSD]]></category>
<pubDate>Sat, 30 Jun 2007 08:49:43 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	　　wget是一个从网络上自动下载文件的自由工具。它支持HTTP，HTTPS和FTP协议，可以使用HTTP代理. <br/><br/>　　所谓的自动下载是指，wget可以在用户退出系统的之后在后台执行。这意味这你可以登录系统，启动一个wget下载任务，然后退出系统，wget将在后台执行直到任务完成，相对于其它大部分浏览器在下载大量数据时需要用户一直的参与，这省去了极大的麻烦。 <br/>　　wget 可以跟踪HTML页面上的链接依次下载来创建远程服务器的本地版本，完全重建原始站点的目录结构。这又常被称作"递归下载"。在递归下载的时候，wget 遵循Robot Exclusion标准(/robots.txt). wget可以在下载的同时，将链接转换成指向本地文件，以方便离线浏览。 <br/>　　wget 非常稳定,它在带宽很窄的情况下和不稳定网络中有很强的适应性.如果是由于网络的原因下载失败，wget会不断的尝试，直到整个文件下载完毕。如果是服务器打断下载过程，它会再次联到服务器上从停止的地方继续下载。这对从那些限定了链接时间的服务器上下载大文件非常有用。 <br/><br/>wget的常见用法<br/>wget虽然功能强大，但是使用起来还是比较简单的，<br/>基本的语法是：wget [参数列表] "URL" 用""引起来可以避免因URL中有特殊字符造成的下载出错。<br/>下面就结合具体的例子来说明一下wget的用法。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;1、下载整个http或者ftp站点。<br/> &nbsp; &nbsp;wget http://place.your.url/here<br/> &nbsp; &nbsp;这个命令可以将http://place.your.url/here 首页下载下来。使用-x会强制建立服务器上一模一样的目录，如果使用-nd参数，那么服务器上下载的所有内容都会加到本地当前目录。 <br/> &nbsp; &nbsp;wget -r http://place.your.url/here<br/> &nbsp; &nbsp;这个命令会按照递归的方法，下载服务器上所有的目录和文件，实质就是下载整个网站。这个命令一定要小心使用，因为在下载的时候，被下载网站指向的所有地址同样会被下载，因此，如果这个网站引用了其他网站，那么被引用的网站也会被下载下来！基于这个原因，这个参数不常用。可以用-l number参数来指定下载的层次。例如只下载两层，那么使用-l 2。<br/><br/> &nbsp; &nbsp;要是您想制作镜像站点，那么可以使用－m参数，例如：wget -m http://place.your.url/here<br/> &nbsp; &nbsp;这时wget会自动判断合适的参数来制作镜像站点。此时，wget会登录到服务器上，读入robots.txt并按robots.txt的规定来执行。</div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;2、断点续传。<br/> &nbsp; &nbsp;当文件特别大或者网络特别慢的时候，往往一个文件还没有下载完，连接就已经被切断，此时就需要断点续传。wget的断点续传是自动的，只需要使用-c参数，例如：<br/> &nbsp; &nbsp;wget -c http://the.url.of/incomplete/file<br/> &nbsp; &nbsp;使用断点续传要求服务器支持断点续传。-t参数表示重试次数，例如需要重试100次，那么就写-t 100，如果设成-t 0，那么表示无穷次重试，直到连接成功。-T参数表示超时等待时间，例如-T 120，表示等待120秒连接不上就算超时。</div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;3、批量下载。<br/> &nbsp; &nbsp;如果有多个文件需要下载，那么可以生成一个文件，把每个文件的URL写一行，例如生成文件download.txt，然后用命令：wget -i download.txt<br/>这样就会把download.txt里面列出的每个URL都下载下来。（如果列的是文件就下载文件，如果列的是网站，那么下载首页）</div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;4、选择性的下载。<br/> &nbsp; &nbsp;可以指定让wget只下载一类文件，或者不下载什么文件。例如：<br/> &nbsp; &nbsp;wget -m --reject=gif http://target.web.site/subdirectory<br/> &nbsp; &nbsp;表示下载http://target.web.site/subdirectory，但是忽略gif文件。--accept=LIST 可以接受的文件类型，--reject=LIST拒绝接受的文件类型。</div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;5、密码和认证。<br/> &nbsp; &nbsp;wget只能处理利用用户名/密码方式限制访问的网站，可以利用两个参数：<br/> &nbsp; &nbsp;--http-user=USER设置HTTP用户<br/> &nbsp; &nbsp;--http-passwd=PASS设置HTTP密码<br/> &nbsp; &nbsp;对于需要证书做认证的网站，就只能利用其他下载工具了，例如curl。</div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; &nbsp;6、利用代理服务器进行下载。<br/> &nbsp; &nbsp;如果用户的网络需要经过代理服务器，那么可以让wget通过代理服务器进行文件的下载。此时需要在当前用户的目录下创建一个.wgetrc文件。文件中可以设置代理服务器：<br/> &nbsp; &nbsp;http-proxy = 111.111.111.111:8080<br/> &nbsp; &nbsp;ftp-proxy = 111.111.111.111:8080<br/> &nbsp; &nbsp;分别表示http的代理服务器和ftp的代理服务器。如果代理服务器需要密码则使用：<br/> &nbsp; &nbsp;--proxy-user=USER设置代理用户<br/> &nbsp; &nbsp;--proxy-passwd=PASS设置代理密码 <br/> &nbsp; &nbsp;这两个参数。<br/> &nbsp; &nbsp;使用参数--proxy=on/off 使用或者关闭代理。</div></div><br/><br/> &nbsp; &nbsp;wget还有很多有用的功能，需要用户去挖掘。<br/><br/>wget的使用格式 <br/>Usage: wget [OPTION]... [URL]...<br/>* 用wget做站点镜像: <br/>wget -r -p -np -k http://dsec.pku.edu.cn/~usr_name/<br/># 或者<br/>wget -m http://dsec.pku.edu.cn/~usr_name/<br/>* 在不稳定的网络上下载一个部分下载的文件，以及在空闲时段下载 <br/>wget -t 0 -w 31 -c http://dsec.pku.edu.cn/BBC.avi -o down.log &<br/># 或者从filelist读入要下载的文件列表<br/>wget -t 0 -w 31 -c -B ftp://dsec.pku.edu.cn/linuxsoft -i filelist.txt -o down.log &<br/>上面的代码还可以用来在网络比较空闲的时段进行下载。我的用法是:在mozilla中将不方便当时下载的URL链接拷贝到内存中然后粘贴到文件filelist.txt中，在晚上要出去系统前执行上面代码的第二条。 <br/>* 使用代理下载 <br/>wget -Y on -p -k https://sourceforge.net/projects/wvware/<br/>代理可以在环境变量或wgetrc文件中设定 <br/># 在环境变量中设定代理<br/>export PROXY=http://211.90.168.94:8080/<br/># 在~/.wgetrc中设定代理<br/>http_proxy = http://proxy.yoyodyne.com:18023/<br/>ftp_proxy = http://proxy.yoyodyne.com:18023/<br/><br/><br/>wget各种选项分类列表<br/>* 启动 <br/> &nbsp;-V, &nbsp;--version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 显示wget的版本后退出<br/> &nbsp;-h, &nbsp;--help &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;打印语法帮助<br/> &nbsp;-b, &nbsp;--background &nbsp; &nbsp; &nbsp; &nbsp;启动后转入后台执行<br/> &nbsp;-e, &nbsp;--execute=COMMAND &nbsp; 执行`.wgetrc'格式的命令，wgetrc格式参见/etc/wgetrc或~/.wgetrc<br/>* 记录和输入文件 <br/> &nbsp;-o, &nbsp;--output-file=FILE &nbsp; &nbsp; 把记录写到FILE文件中<br/> &nbsp;-a, &nbsp;--append-output=FILE &nbsp; 把记录追加到FILE文件中<br/> &nbsp;-d, &nbsp;--debug &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;打印调试输出<br/> &nbsp;-q, &nbsp;--quiet &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;安静模式(没有输出)<br/> &nbsp;-v, &nbsp;--verbose &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;冗长模式(这是缺省设置)<br/> &nbsp;-nv, --non-verbose &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;关掉冗长模式，但不是安静模式<br/> &nbsp;-i, &nbsp;--input-file=FILE &nbsp; &nbsp; &nbsp;下载在FILE文件中出现的URLs<br/> &nbsp;-F, &nbsp;--force-html &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 把输入文件当作HTML格式文件对待<br/> &nbsp;-B, &nbsp;--base=URL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 将URL作为在-F -i参数指定的文件中出现的相对链接的前缀<br/> &nbsp; &nbsp; &nbsp; --sslcertfile=FILE &nbsp; &nbsp; 可选客户端证书<br/> &nbsp; &nbsp; &nbsp; --sslcertkey=KEYFILE &nbsp; 可选客户端证书的KEYFILE<br/> &nbsp; &nbsp; &nbsp; --egd-file=FILE &nbsp; &nbsp; &nbsp; &nbsp;指定EGD socket的文件名<br/>* 下载 <br/> &nbsp; &nbsp; &nbsp; --bind-address=ADDRESS &nbsp; 指定本地使用地址(主机名或IP，当本地有多个IP或名字时使用)<br/> &nbsp;-t, &nbsp;--tries=NUMBER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 设定最大尝试链接次数(0 表示无限制).<br/> &nbsp;-O &nbsp; --output-document=FILE &nbsp; 把文档写到FILE文件中<br/> &nbsp;-nc, --no-clobber &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 不要覆盖存在的文件或使用.#前缀<br/> &nbsp;-c, &nbsp;--continue &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 接着下载没下载完的文件<br/> &nbsp; &nbsp; &nbsp; --progress=TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;设定进程条标记<br/> &nbsp;-N, &nbsp;--timestamping &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 不要重新下载文件除非比本地文件新<br/> &nbsp;-S, &nbsp;--server-response &nbsp; &nbsp; &nbsp; &nbsp;打印服务器的回应<br/> &nbsp; &nbsp; &nbsp; --spider &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 不下载任何东西<br/> &nbsp;-T, &nbsp;--timeout=SECONDS &nbsp; &nbsp; &nbsp; &nbsp;设定响应超时的秒数<br/> &nbsp;-w, &nbsp;--wait=SECONDS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 两次尝试之间间隔SECONDS秒<br/> &nbsp; &nbsp; &nbsp; --waitretry=SECONDS &nbsp; &nbsp; &nbsp;在重新链接之间等待1...SECONDS秒<br/> &nbsp; &nbsp; &nbsp; --random-wait &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;在下载之间等待0...2*WAIT秒<br/> &nbsp;-Y, &nbsp;--proxy=on/off &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 打开或关闭代理<br/> &nbsp;-Q, &nbsp;--quota=NUMBER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 设置下载的容量限制<br/> &nbsp; &nbsp; &nbsp; --limit-rate=RATE &nbsp; &nbsp; &nbsp; &nbsp;限定下载输率<br/>* 目录 <br/> &nbsp;-nd &nbsp;--no-directories &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;不创建目录<br/> &nbsp;-x, &nbsp;--force-directories &nbsp; &nbsp; &nbsp; &nbsp; 强制创建目录<br/> &nbsp;-nH, --no-host-directories &nbsp; &nbsp; &nbsp; 不创建主机目录<br/> &nbsp;-P, &nbsp;--directory-prefix=PREFIX &nbsp; 将文件保存到目录 PREFIX/...<br/> &nbsp; &nbsp; &nbsp; --cut-dirs=NUMBER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 忽略 NUMBER层远程目录<br/>* HTTP 选项 <br/> &nbsp; &nbsp; &nbsp; --http-user=USER &nbsp; &nbsp; &nbsp;设定HTTP用户名为 USER.<br/> &nbsp; &nbsp; &nbsp; --http-passwd=PASS &nbsp; &nbsp;设定http密码为 PASS.<br/> &nbsp;-C, &nbsp;--cache=on/off &nbsp; &nbsp; &nbsp; &nbsp;允许/不允许服务器端的数据缓存 (一般情况下允许).<br/> &nbsp;-E, &nbsp;--html-extension &nbsp; &nbsp; &nbsp;将所有text/html文档以.html扩展名保存<br/> &nbsp; &nbsp; &nbsp; --ignore-length &nbsp; &nbsp; &nbsp; 忽略 `Content-Length'头域<br/> &nbsp; &nbsp; &nbsp; --header=STRING &nbsp; &nbsp; &nbsp; 在headers中插入字符串 STRING<br/> &nbsp; &nbsp; &nbsp; --proxy-user=USER &nbsp; &nbsp; 设定代理的用户名为 USER<br/> &nbsp; &nbsp; &nbsp; --proxy-passwd=PASS &nbsp; 设定代理的密码为 PASS<br/> &nbsp; &nbsp; &nbsp; --referer=URL &nbsp; &nbsp; &nbsp; &nbsp; 在HTTP请求中包含 `Referer: URL'头<br/> &nbsp;-s, &nbsp;--save-headers &nbsp; &nbsp; &nbsp; &nbsp;保存HTTP头到文件<br/> &nbsp;-U, &nbsp;--user-agent=AGENT &nbsp; &nbsp;设定代理的名称为 AGENT而不是 Wget/VERSION.<br/> &nbsp; &nbsp; &nbsp; --no-http-keep-alive &nbsp;关闭 HTTP活动链接 (永远链接).<br/> &nbsp; &nbsp; &nbsp; --cookies=off &nbsp; &nbsp; &nbsp; &nbsp; 不使用 cookies.<br/> &nbsp; &nbsp; &nbsp; --load-cookies=FILE &nbsp; 在开始会话前从文件 FILE中加载cookie<br/> &nbsp; &nbsp; &nbsp; --save-cookies=FILE &nbsp; 在会话结束后将 cookies保存到 FILE文件中<br/>* FTP 选项 <br/> &nbsp;-nr, --dont-remove-listing &nbsp; 不移走 `.listing'文件<br/> &nbsp;-g, &nbsp;--glob=on/off &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 打开或关闭文件名的 globbing机制<br/> &nbsp; &nbsp; &nbsp; --passive-ftp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 使用被动传输模式 (缺省值).<br/> &nbsp; &nbsp; &nbsp; --active-ftp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;使用主动传输模式<br/> &nbsp; &nbsp; &nbsp; --retr-symlinks &nbsp; &nbsp; &nbsp; &nbsp; 在递归的时候，将链接指向文件(而不是目录)<br/>* 递归下载 <br/> &nbsp;-r, &nbsp;--recursive &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;递归下载－－慎用!<br/> &nbsp;-l, &nbsp;--level=NUMBER &nbsp; &nbsp; &nbsp; 最大递归深度 (inf 或 0 代表无穷).<br/> &nbsp; &nbsp; &nbsp; --delete-after &nbsp; &nbsp; &nbsp; 在现在完毕后局部删除文件<br/> &nbsp;-k, &nbsp;--convert-links &nbsp; &nbsp; &nbsp;转换非相对链接为相对链接<br/> &nbsp;-K, &nbsp;--backup-converted &nbsp; 在转换文件X之前，将之备份为 X.orig<br/> &nbsp;-m, &nbsp;--mirror &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 等价于 -r -N -l inf -nr.<br/> &nbsp;-p, &nbsp;--page-requisites &nbsp; &nbsp;下载显示HTML文件的所有图片<br/>* 递归下载中的包含和不包含(accept/reject) <br/> &nbsp;-A, &nbsp;--accept=LIST &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;分号分隔的被接受扩展名的列表<br/> &nbsp;-R, &nbsp;--reject=LIST &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;分号分隔的不被接受的扩展名的列表<br/> &nbsp;-D, &nbsp;--domains=LIST &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分号分隔的被接受域的列表<br/> &nbsp; &nbsp; &nbsp; --exclude-domains=LIST &nbsp; &nbsp; &nbsp; 分号分隔的不被接受的域的列表<br/> &nbsp; &nbsp; &nbsp; --follow-ftp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 跟踪HTML文档中的FTP链接<br/> &nbsp; &nbsp; &nbsp; --follow-tags=LIST &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分号分隔的被跟踪的HTML标签的列表<br/> &nbsp;-G, &nbsp;--ignore-tags=LIST &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分号分隔的被忽略的HTML标签的列表<br/> &nbsp;-H, &nbsp;--span-hosts &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 当递归时转到外部主机<br/> &nbsp;-L, &nbsp;--relative &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 仅仅跟踪相对链接<br/> &nbsp;-I, &nbsp;--include-directories=LIST &nbsp; 允许目录的列表<br/> &nbsp;-X, &nbsp;--exclude-directories=LIST &nbsp; 不被包含目录的列表<br/> &nbsp;-np, --no-parent &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;不要追溯到父目录<br/>问题<br/>在递归下载的时候，遇到目录中有中文的时候，wget创建的本地目录名会用URL编码规则处理。如"天网防火墙"会被存为"%CC%EC%CD%F8%B7%C0%BB%F0%C7%BD",这造成阅读上的困难。<br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">wget -r -N -l 3 -np -p -b -k http://www.jobzone.cn</div></div><br/><br/><br/>现在ArthurXF本人正在搞PHP等技术培训，如果想学习的人可以跟我联系。另外培训的招生简章在这个网址，想了解的可以去看看。加我QQ：29011218交流也可。<br/><a href="http://www.bizeway.net/read.php/285.htm" target="_blank">PHP培训招生简章</a><br/>Tags - <a href="tag.php?tag=freebsd" rel="tag">freebsd</a> , <a href="tag.php?tag=wget" rel="tag">wget</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 跟着ArthurXF学FreeBSD26——wget用法详解]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>