由于程序也要关注seo所以我们必须会查看和记录搜素引擎的爬行记录简单的谢了一下!

	/*
	 * agent.php
	 * @author			肖伟
	 * @description     测试简单的爬虫爬行记录
	 * @copyright		Copyright (c) 2012. yun.widuu.com
	 */
    $ServerName = $_SERVER["SERVER_NAME"] ;  //主机名
	$ServerPort = $_SERVER["SERVER_PORT"] ;  //端口   
	$ScriptName = $_SERVER["SCRIPT_NAME"] ;  //当前脚本的路径
	$QueryString = $_SERVER["QUERY_STRING"]  ;    //query string查询字符串
	$serverip = $_SERVER["REMOTE_ADDR"] ;    //IP地址     
	$Url="http://".$ServerName ;			
	If ($ServerPort != "80") 
	    {$Url = $Url.":".$ServerPort ; }    //端口如果不是80端口的组合
	$Url=$Url.$ScriptName ;					//访问的路径
	If ($QueryString !="")					
	    {$Url=$Url."?".$QueryString  ; }    //组合路径  
	$GetLocationURL=$Url ;
    $agent1 = $_SERVER["HTTP_USER_AGENT"] ;  
	$agent=strtolower($agent1);
	$Bot ="";
    if (strpos($agent,"bot")>-1)
	    {$Bot = "其它蜘蛛";}
	if (strpos($agent,"googlebot")>-1)
	    {$Bot = "Google";}           
    if (strpos($agent,"mediapartners-google")>-1)
	   {$Bot = "Google Adsense";}
	if (strpos($agent,"baiduspider")>-1)
	   {$Bot = "Baidu";}
	if (strpos($agent,"sogou spider")>-1)
	   {$Bot = "Sogou";}
	if (strpos($agent,"yahoo")>-1)
	   {$Bot = "Yahoo!";}
	if (strpos($agent,"msn")>-1)
	   {$Bot = "MSN";}
	if (strpos($agent,"ia_archiver")>-1)
	   {$Bot = "Alexa";}
	if (strpos($agent,"iaarchiver")>-1)
	   {$Bot = "Alexa";}
	if (strpos($agent,"sohu")>-1)
	   {$Bot = "Sohu";}
	if (strpos($agent,"sqworm")>-1) 
	   {$Bot = "AOL";}
	if (strpos($agent,"yodaoBot")>-1)
	   {$Bot = "Yodao";}
	if (strpos($agent,"iaskspider")>-1)
	   {$Bot = "Iask";}
	$shijian=date("Y-m-d h:i:s", time());
	$str=file_get_contents("wdphp.htm")."爬虫类型:".$Bot."访问IP:".$serverip."访问时间:".$shijian."访问地址:".$GetLocationURL."<br>";
	$zhizhu=file_put_contents("wdphp.htm",$str);  
	
wdphp.htm 爬虫记录 本机不能测试,希望哪位可以测试一下看看好用不,谢谢了哈!欢迎转载,转载请注明来自微度网络,网络技术中心《

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部