电脑安全

您当前的位置:主页 > 电脑安全 >

google 收录查询代码-网络编程

来源:[db:来源]标题:   情况    编辑:电脑技术全能网 时间:2019-09-18 16:51

原标题:google 收录查询代码-网络编程
   本代码是一款站长罕用东西了,用来查问google 收录代码,能够查问天 <option value="1">自界说天数</option> <option value="d">查问昨日收录情形</option> <option value="w">查问近来1礼拜收录情形</option> <option value="m">查问近来1月收录情形</option> <option value="m2">查问近来2月收录情形</option> <option value="m3">查问近来3月收录情形</option> <option value="m6">查问近来6月收录情形</option> <option value="y">查问近来1年收录情形</option> <option value="all">查问总的(全部日期)收录情形</option>等信息。function GetPage($url){$buf=parse_url($url);if($buf['scheme']=="http")//假如是URL{$host=$buf['host'];$page=$buf['path'];if(trim($buf['query'])!=="") $page.="?".trim($buf['query']);$myHeader="GET $url HTTP/1.1rn";$myHeader.="Host: $hostrn";$myHeader.="Connection: closern";$myHeader.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5rn";$myHeader.="Accept-Language: zh-cn,zh;q=0.5rn";$myHeader.="Accept-Charset: gb2312,utf-8;q=0.7,*;q=0.7rn";$myHeader.="User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.7.6) Gecko/20050226 Firefox/1.0.1 Web-Sniffer/1.0.20rn";$myHeader.="Referer: http://$host/rnrn";$server=$host;$port=80;$res="";if(false!==($fp = @fsockopen ($server, $port, $errno, $errstr, 30))){@fputs ($fp, $myHeader);while (!@feof($fp)) $res.= @fgets ($fp, 1024);@fclose ($fp);}else return false;if(strlen($res)==0) return false;return $res;}else//假如是当地文件{$fileName=$url;if(false!==@file_exists($fileName)){if(false!==($buf=@implode("",file($fileName)))&&@strlen($buf)>0) {return $buf;}else return false;}else return false;}}function GetContent($str,$x,$y){$tem=strstr($str,$x);return substr($tem,0, strpos($tem,$y));}对获得的google信息停止剖析而且在当地。if (isset($q)){$TheUrl="http://www.google.cn/search?q=+site:".$q."&num=20&complete=1&hl=zh-CN&lr=&newwindow=1&as_qdr=".$t."&start=".$p."&sa=N";$TheThie=GetPage($TheUrl);}$TheBody=GetContent($TheThie,"<div id=res class=med>","<div id=bsf style"); $TheBody=iconv( "UTF-8", "gb2312//IGNORE" , $TheBody);$TheBody=str_replace("<!--z--><p><i>","<!--z--><!--<p><i>",$TheBody);$TheBody=str_replace('<br clear="all"/>','<br clear="all"/>',$TheBody); $TheBody=preg_replace('<a href="/search?num=20(.+?)amp;as_qdr=(.+?)&amp;q=site:(.+?)&amp;start=(.+?)&amp;sa=N">','a href=?q=$3&t=$2&p=$4>&nbsp;&nbsp;&nbsp;&nbsp;<!--z--',$TheBody);$TheBody=str_replace("该网站能够含有歹意软件,有能够会迫害您的电脑。","",$TheBody);$TheBody=str_replace("/interstitial?url=","",$TheBody);$TheBody=str_replace("- <nobr>","",$TheBody);$TheBody=str_replace("相似网页","",$TheBody); $total=GetContent($TheThie,"</b></div><p>","</b> - <b>"); $total=iconv( "UTF-8", "gb2312//IGNORE" , $total); $total=GetContent($total,"有 <b>","</b> 项");$total=str_replace("有 <b>","",$total);$total=str_replace(",","",$total); $total=intval($total);

上一篇:php编写的ACCESS处理类-网络编程

下一篇:没有了