Self-written php curl library for full-site cloning, phpcurl

Source: Internet
Author: User

Self-written php curl library for full-site cloning, 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. Here we have provided a demo <? Phpclass 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 ';}}

<?phpclass 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 ['enableDownload'] = true;  $curl->cache ['dir'] = $cacheDir;  $curl->cache ['compress'] = true;  $clone = new MyCurl_Clone ( $curl, $url, $dir );  $clone->overwrite = true;  $clone->start ();  return false; }}

The corresponding file has been uploaded to http://download.csdn.net/detail/tiaozhanji_xian/8951277, without points.


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.