PHP 哪个搜索引擎将用户引荐到您的网站。显示使用的关键字。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 哪个搜索引擎将用户引荐到您的网站。显示使用的关键字。相关的知识,希望对你有一定的参考价值。

if ((isset($_SERVER['HTTP_REFERER'])) and ($_SERVER['HTTP_REFERER']!= '')) {
$keywords = "";
$url = urldecode($_SERVER['HTTP_REFERER']);

// Google
if (eregi("www\.google",$url)) {
preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords);
$search_engine = 'Google';
}

// Yahoo
if ((eregi("yahoo\.com",$url)) or (eregi("search\.yahoo",$url))) {
preg_match("'(\?¦&)p=(.*?)(&¦$)'si", " $url ", $keywords);
$search_engine = 'Yahoo';
}

// MSN
if (eregi("search\.msn",$url)) {
preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords);
$search_engine = 'MSN';
}

// AllTheWeb
if (eregi("www\.alltheweb",$url)) {
preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords);
$search_engine = 'AllTheWeb';
}

// Looksmart
if (eregi("looksmart\.com",$url)) {
preg_match("'(\?¦&)qt=(.*?)(&¦$)'si", " $url ", $keywords);
$search_engine = 'Looksmart';
}

if (($keywords[2]!= '') and ($keywords[2]!= ' ')) {
$keywords = preg_replace('/"¦\'/', '', $keywords[2]); // Remove quotes
}
echo $keywords;
echo $search_engine;
}

以上是关于PHP 哪个搜索引擎将用户引荐到您的网站。显示使用的关键字。的主要内容,如果未能解决你的问题,请参考以下文章

PHP 将任何网站图像保存到您的服务器

php 这是来自Christopher Dubeau的Local Business SEO插件的代码。它旨在将本地业务架构数据添加到您的网站,whi

PHP:如何获取引荐来源网址?

基于 IP 和引荐来源的 PHP 重定向

哪个搜索引擎正在向您的站点推荐用户。显示使用的关键字。

php 使用此功能将Gists嵌入到您的博客帖子中