php

位置:IT落伍者 >> php >> 浏览文章

PHP通过访客来路获取搜索关键词的方法


发布日期:2021年08月30日
 
PHP通过访客来路获取搜索关键词的方法

<?phpclass keyword{public function getKeyword($referer){if(strpos($referer"{$keyword = $this>getbaidukeyword($referer);}else if(strpos($referer"{$keyword = $this>getgooglekeyword($referer);}else if(strpos($referer"{$keyword = $this>getsosokeyword($referer);}else if(strpos($referer"{$keyword = $this>getsogoukeyword($referer);}return $keyword;}//由来路取得百度关键词private function getbaidukeyword($str){$s = strpos($strwd=);if($s>){$str = substr($str$s+);$e = strpos($str&);if($e>){$str = substr($str$e);}$str = rawurldecode($str);}return $str;}//获得谷歌关键词private function getgooglekeyword($str){$s = strpos($str&q=);if($s>){$str = substr($str$s+);$e = strpos($str&);if($e>){$str = substr($str$e);}$str = rawurldecode($str);}return $str;}//获得SOSO关键词private function getsosokeyword($str){$s = strpos($str?w=);if($s>){$str = substr($str$s+);$e = strpos($str&);if($e>){$str = substr($str$e);}$str = rawurldecode($str);}else{$s = strpos($str&w=);if($s>){$str = substr($str$s+);$e = strpos($str&);if($e>){$str = substr($str$e);}$str = rawurldecode($str);}}return $str;}//获得sogou关键词private function getsogoukeyword($str){$s = strpos($strquery=);if($s>){$str = substr($str$s+);$e = strpos($str&);if($e>){$str = substr($str$e);}$str = rawurldecode($str);}return $str;}}?>

上一篇:php正则匹配获取指定url网页页面超级链接地址

下一篇:解析php中获取系统信息的方法