Posted in PHP onFebruary 13, 2014
$rfr = $_SERVER['HTTP_REFERER']; //if(!$rfr) $rfr='http://'.$_SERVER['HTTP_HOST']; if($rfr) { $p=parse_url($rfr); parse_str($p['query'],$pa); $p['host']=strtolower($p['host']); $arr_sd_key=array( 'baidu.com'=>'word', 'google.com'=>'q', 'sina.com.cn'=>'word', 'sohu.com'=>'word', 'msn.com'=>'q', 'bing.com'=>'q', '163.com'=>'q', 'yahoo.com'=>'p' ); $keyword=''; $sengine=$p['host']; foreach($arr_sd_key as $se=>$kwd) { if(strpos($p['host'],$se)!==false) { $keyword=$pa[$kwd]; $sengine=$se; break; } } $sql="insert into visit_log(domain,key_word,ct)"; }
使用php记录用户通过搜索引擎进网站的关键词
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@