Home > Backend Development > PHP Tutorial > Use PHP to record the keywords that users enter the website through search engines_PHP tutorial

Use PHP to record the keywords that users enter the website through search engines_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:37:35
Original
1071 people have browsed it

复制代码 代码如下:

$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)";
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/735235.htmlTechArticle复制代码 代码如下: $rfr = $_SERVER['HTTP_REFERER']; //if(!$rfr) $rfr='http://'.$_SERVER['HTTP_HOST']; if($rfr) { $p=parse_url($rfr); parse_str($p['query'],$pa); $p['host']=...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template