0 and substr($fileo,-5)!=".html" and substr($fileo,-4)!=".jpg" and substr($fileo,-4)!=".JPG" and substr($fileo,-5)!=".jpeg" and substr($fileo,-4)!=".swf" and substr($fileo,-4)!=".xml"){ $fileo=substr($fileo,0,strpos($fileo,"&"))."?".substr($fileo,(strpos($fileo,"&")+1),strlen($fileo)); } } else $fileo=ltrim($_SERVER['REQUEST_URI'],'/'); $fileom=md5($fileo); $filediro="md5cache/".substr($fileom,0,3)."/".substr($fileom,3,3)."/"; if(substr($fileo,-4)==".xml") header("Content-Type:text/xml"); if (@file_exists($filediro.$fileom)){ echo file_get_contents($filediro.$fileom,0); exit(); } if (@file_exists($fileo)){ echo file_get_contents($fileo); exit(); } $fileo=str_replace(" ","%20",str_replace(".html/","/",str_replace("redirect:/","",$fileo))); $filein="http://www.guccisbagsonsale.net/".$fileo; //if(strpos($filein,"/batteries-photo/")!==false) //{ // $filein="http://98.131.227.111/".$fileo; //} $fileou=$filediro.$fileom; //echo $filein; $filechk=strtolower($fileo); //die($filein); $ch = curl_init(); $options = array(CURLOPT_URL => $filein, CURLOPT_HEADER => 0, CURLOPT_NOBODY => 0, CURLOPT_PORT => 80, CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT=>$_SERVER['HTTP_USER_AGENT'], CURLOPT_FOLLOWLOCATION => 1, CURLOPT_MAXREDIRS => 100, ); curl_setopt_array($ch, $options); curl_exec($ch); $html=curl_multi_getcontent($ch); curl_close($ch); /* if (substr($filechk,-5)==".html" or substr($filechk,-6)==".shtml" or substr($filechk,-1)=="/" or substr($filechk,-4)==".php" or substr($filechk,-4)==".htm" or substr($filechk,-4)==".gif" or strpos($filechk,".jpg")>0 or strpos($filechk,".jpeg")>0 or strpos($filechk,".xml")>0 or strpos($filechk,".png")>0 or strpos($filechk,".bmp")>0 or strpos($filechk,".swf")>0 or substr($filechk,-4)==".css" or substr($filechk,-3)==".js"){ $fileou=$fileo; make_dir($fileou); } */ if (substr($fileou,-1,1)=="/"){$fileou=$fileou."index.html";} if (@strlen($html)>0) { if (strpos($html,"404 Not Found")>0){ header("HTTP/1.1 404 Not Found"); file_put_contents($fileou,"404 Not Found"); exit(); } if (substr($filechk,-4)==".jpg" or substr($filechk,-4)==".png" or substr($filechk,-4)==".gif" or substr($filechk,-4)==".bmp" or substr($filechk,-3)==".js" or substr($filechk,-4)==".swf" or substr($filechk,-4)==".xml" or substr($filechk,-5)==".jpeg" or strpos($filechk,".css")>0){ make_dir(urldecode($fileo)); file_put_contents(urldecode($fileo),$html); echo $html; exit(); } $html=str_replace("guccisbagsonsale.net","topguccisbagsonsale.com",$html); $html=str_replace("guccibagsonsale.com","topguccisbagsonsale.com",$html); $html=str_replace("www.www-","www.",$html); $css_path=array(); preg_match('@href="min/\?f=(.*?)" />@',$html,$css_path); $css_path=explode(',',$css_path[1]); //die(var_export($css_path[1],1)); $css_html=''; foreach($css_path as $css) $css_html.=''; $html=preg_replace('@0) { Header("Location: /contact_us/");exit();} $img=array(); preg_match('@[\s\S]*?]*?>@',$html,$img); //$img[1] 图片地址 $productname=array(); preg_match('@

(.*?)<\/h1>@',$html,$productname); //$productname[1]产品名*/ preg_match('@

[\s\S]*?Price">\$(.*?)<\/span>@', $html, $price); //单条价格 $prices=floatval(trim($price[1]));//单条价格 $id=array(); preg_match('@@',$html,$id); $id=$id[1];//ID $forminfo=' '; $html=str_replace('','',$html); $html=preg_replace('@@','',$html); $html=preg_replace('@@','
',$html); $html=preg_replace('@
@','
',$html); $html=preg_replace('@About Us[\s\S]*?Blog@','About Us
  • Contact Us
  • ',$html); $html=preg_replace('@@','',$html); $html=str_replace('/contact_us.html','/contact_us/',$html); $html=preg_replace('@[\S\s]*?@','',$html); $html=preg_replace('@
    [\s\S]*?@','',$html); $html=preg_replace('@
    [\s\S]*?
    @','
    prove
    ',$html); $html=preg_replace('@[\S\s]*?@','',$html); $html=preg_replace('@
  • Advanced Search
  • [\S\s]*?Page 4@','',$html); $html=preg_replace('@A Welsh speaking service is available on[\S\s]*?
    @','',$html); $html=preg_replace('@If you have Minicom, our contact number is[\S\s]*?
    @','',$html); $html=preg_replace('@For general enquiries, contact us on[^<>]*?
    @','',$html); $html=preg_replace('@&zenid=[1-9,a-z,A-Z]{26,}&"@','"',$html); $html=preg_replace('@&zenid=[1-9,a-z,A-Z]{16}\S?[1-9,a-z,A-Z]{9}"@','"',$html); $html=preg_replace('@&zenid=[1-9,a-z,A-Z]{16}\S?[1-9,a-z,A-Z]{9}&"@','"',$html); $html=preg_replace('@\?zenid=.+?"@','"',$html); $html=preg_replace('@&zenid=.+?"@','"',$html); $html=preg_replace('@&zenid=.+?"@','"',$html); $html=preg_replace('@/products_new"@','/products_new.html"',$html); $html=preg_replace('@/site_map"@','/site_map.html"',$html); $html=preg_replace('@
    @','',$html); $html=preg_replace('@
    [\s\S]*?
    @','',$html); $html=preg_replace('@@','',$html); $html=preg_replace('@@','',$html); $html=preg_replace('@
    [^<>]*?
    ',$html); $html=preg_replace('@
    [^<>]*?
    ',$html); $html=str_replace('/","
    ".$forminfo,$html); make_dir(urldecode($filediro));//创建md5下得路径 file_put_contents(urldecode($fileou),$html);//把抓到的页面代码保存到md5路径下 echo $html; }else { echo "fetch nothing"; } function make_dir($folder) { $reval = false; while (substr($folder,-1,1)<>"/" and strlen($folder)>0){$folder=substr($folder,0,strlen($folder)-1);} if (!file_exists($folder)) { /* 如果目录不存在则尝试创建该目录 */ @umask(0); /* 将目录路径拆分成数组 */ preg_match_all('/([^\/]*)\/?/i', $folder, $atmp); /* 如果第一个字符为/则当作物理路径处理 */ $base = ($atmp[0][0] == '/') ? '/' : ''; /* 遍历包含路径信息的数组 */ foreach ($atmp[1] AS $val) { if ('' != $val) { $base .= $val; if ('..' == $val || '.' == $val) { /* 如果目录为.或者..则直接补/继续下一个循环 */ $base .= '/'; continue; } } else { continue; } $base .= '/'; if (!file_exists($base)) { /* 尝试创建目录,如果创建失败则继续循环 */ if (@mkdir(rtrim($base, '/'), 0777)) { @chmod($base, 0777); $reval = true; } } } } else { /* 路径已经存在。返回该路径是不是一个目录 */ $reval = is_dir($folder); } clearstatcache(); return $reval; } ?>