The self-written phpcurl library implements the whole-site cloning function, phpcurl. You can write your own phpcurl library to clone the whole site. phpcurl sometimes uses online manuals, such as domestic or foreign ones, which are slow to access, some of them are php curl libraries written by the author to achieve the whole site cloning function, phpcurl
Sometimes some online manuals, such as those in China or abroad, are frequently used. some of them are slow access speeds. some of them are caused by direct website shutdown, and some are caused by server downtime, therefore, it is better to clone the entire server to your own server.
Kutetes:
Given an initial connection, all objects at the level below the initial link will be copied to the local device.
You can configure whether to overwrite multiple clones.
You can configure whether to download images.
Replace all links with relative links, so you can rewrite them as needed.
No issues such as file overwrite will occur.
The most characteristic of NB is that there is no more NB library than this.
SVN: http://svn.phpdr.net/repos/ares/php/library/trunk/lib/CurlMulti/MyCurl/Clone.php
Help house Download: http://xiazai.jb51.net/201502/other/CurlMulti.rar
Clone result Display (this clone operation is completed in seconds ):
Kelon source site: http://www.laruence.com/manual/
Clone result: http://manual.phpdr.net/yaf/
Demo code:
The code is as follows:
<? Php
Class Controller_Spider extends MyYaf_Controller_Base {
Function init (){
Parent: init ();
If (! $ This-> getRequest ()-> isCli ()){
Ares_Http: error403 ();
}
Include 'curlmulti/CurlMulti. php ';
Include 'curlmulti/MyCurl. php ';
Include 'phpquery. php ';
}
}
The code is as follows:
<? Php
Class YafdocController extends Controller_Spider {
Function init (){
Parent: init ();
Include 'curlmulti/MyCurl/Clone. php ';
}
Function indexAction (){
$ Url = 'http: // www.laruence.com/manual ';
$ Dir = Yaf_Application: app ()-> getAppDirectory (). '/data/manual ';
$ CacheDir = $ this-> getBaseDir (). '/cache/curl ';
If (! Is_dir ($ cacheDir )){
Mkdir ($ cacheDir );
}
$ Curl = new CurlMulti ();
$ Curl-> maxThread = 10;
$ Curl-> cache ['enable'] = true;
$ Curl-> cache ['enablesdownload'] = true;
$ Curl-> cache ['dir'] = $ cacheDir;
$ Curl-> cache ['compus'] = true;
$ Clone = new MyCurl_Clone ($ curl, $ url, $ dir );
$ Clone-> overwrite = true;
$ Clone-> start ();
Return false;
}
}
The curl library implements the whole site cloning function. phpcurl sometimes uses some online manuals, such as domestic or foreign ones. some of them are slow access speeds, and some are direct access speeds...