这个应该怎么解决呢?
就是一个小说小偷
http://ttkshu.com
http://qqrom.cn
这样子的总是被空间商警告说cpu占用过高
如何优化呢?
有没有相关的文章

解决方案 »

  1.   

    放慢偷的速度就低了。每偷一个页sleep(1);
      

  2.   


    // 书目规则
    $curl = 'http://www.paoshu8.com/Html/Book/'.$cid.'/'.$bid.'/Index.shtm';//偷取地址
    $pt->load($curl);
    $content = $pt->result('content');//获得代码

    $pt_templets_bookname = $pt->steal($content,'小说','免费阅读',false,false);//$pt->steel是一个类 获取2个指定代码中间的值
    $pt_templets_bookname = str_replace('《','',$pt_templets_bookname);
    $pt_templets_bookname = str_replace('》','',$pt_templets_bookname);
    $pt_templets_author = $pt->steal($content,'是作者:',',查阅',false,false);
    $pt_templets_showtime = $pt->steal($content,'最新更新:','|',false,false);
    $pt_templets_readlist = $pt->steal($content,' <div id="BookText">','<div id="End">',false,false);
    $pt_templets_readlist = str_replace(' </div>','',$pt_templets_readlist);

    if ($pt_config_reurl){
    $pt_templets_readlist = preg_replace('/href="(.*).shtm"/','href="'.$pt_site_url.str_replace('<cid>',$cid,str_replace('<sid>','\\1',str_replace('<bid>',$bid,$pt_reurl_show))).'"',$pt_templets_readlist);
    }else{
    $pt_templets_readlist = preg_replace('/href="(.*).shtm"/','href="'.$pt_site_url.$pt_file_show.'?cid='.$cid.'&bid='.$bid.'&sid=\\1"',$pt_templets_readlist);
    }
    $pt_templets_bookbid=$bid;

    include 'geturl.php';

    // 规则结束
      

  3.   

    主要是geturl.php要贴出来的哇,这里是关键