wget is a command line download file tool that supports the HTTP,HTTPS and FTP protocols and can use HTTP proxies. Linux users often need to use it. Here are some tips for using wget. wget Skills Daquan: 1> download all files in the packs directory on the http://www.linux.com Web site $ wget-r-np-nd http://www.linux.com/packs/ The role of-NP is not to traverse the parent directory -nd indicates that the directory structure is not recreated on this computer. 2> download the entire HTTP or FTP site $ wget-r-X http://www.linux.com The role of-X forces the creation of identical directories on the server This command will download all the directories and files on the recursive download server, which means downloading the entire site. At the time of downloading, all the addresses pointed to by the downloaded Web site will be downloaded, and if the site references other sites, the referenced sites will be downloaded ... Note: You can use the-l number parameter to specify the level of the download. For example, download only two tiers, then use-l 2. such as: Wget-r-x-l 2 http://www.linux.com 3>wget selectively downloads only certain types of files $ wget-r-np-nd–accept=iso http://www.linux.com/i386/ –accept=iso option, which indicates that wget downloads only files in the I386 directory that have the ISO file name extension. You can also specify multiple extension names, separated by commas. 4> Bulk Download Wget-i Downloads.txt If you have multiple files that need to be downloaded, put all the addresses that need to be downloaded into downloads.txt (one line for each file URL), and then wget will automatically download all the files for you. 5> Breakpoint Continuous transmission $ wget-c-T 100-t http://www.linux.com/big-file.iso When the file is particularly large or the network is particularly slow, often a file has not been downloaded, the connection has been cut off, this time need to continue to pass the breakpoint. The wget of the breakpoint is automatic. The-c option acts as a breakpoint continuation. The-t parameter indicates the number of retries (for example, you need to retry 100 times, then write-T 100, if set to-T 0, then an infinite retry until the connection succeeds.) ) The-t parameter indicates a timeout wait time, such as-t 120, which means that waiting for a 120-second connection is not even timed out. 6> Mirrors a Web site $ wget-m-K (-h) http://www.linux.com/ If the image in the site is on a different site, you can use the-H option.
In PHP, wget still use more, because sometimes grab resources or pictures and so on, This time file_get_contents is not easy to use, and wget can set the number of crawls, time and so on, These are not available to the file_get_contents, wget is a shell command, and PHP would be nice if you wanted to invoke the Exec () function directly. EXEC ("wget-i xxxxx xxxxx");
|