帮我自动导向关键字搜索引擎 [英] Help Me auto directed keyword search engine
问题描述
我想获得可以在我的网站上找到的关键字
我的示例代码
pcboxsearch.class.php
I want to get keywords that you can find on my website
example me code
pcboxsearch.class.php
<?php
class search_keywords
{
var $referer;
var $search_engine;
var $keys;
var $sep;
function search_keywords()
{
$this->referer = '';
$this->sep = '';
if ($_SERVER['HTTP_REFERER'] OR $_ENV['HTTP_REFERER'])
{
$this->referer = urldecode(($_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : $_ENV['HTTP_REFERER']));
$this->sep = (eregi('(\?q=|\?qt=|\?p=)', $this->referer)) ? '\?' : '\&';
}
}
function get_keys()
{
if (!empty($this->referer))
{
if (eregi('www\.google', $this->referer))
{
// Google
preg_match("#{$this->sep}q=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'Google';
}
else if (eregi('(yahoo\.com|search\.yahoo)', $this->referer))
{
// Yahoo
preg_match("#{$this->sep}p=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'Yahoo';
}
else if (eregi('search\.msn', $this->referer))
{
// MSN
preg_match("#{$this->sep}q=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'MSN';
}
else if (eregi('www\.alltheweb', $this->referer))
{
// AllTheWeb
preg_match("#{$this->sep}q=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'AllTheWeb';
}
else if (eregi('(looksmart\.com|search\.looksmart)', $this->referer))
{
// Looksmart
preg_match("#{$this->sep}qt=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'Looksmart';
}
else if (eregi('(askjeeves\.com|ask\.com)', $this->referer))
{
// AskJeeves
preg_match("#{$this->sep}q=(.*?)\&#si", $this->referer, $this->keys);
$this->search_engine = 'AskJeeves';
}
else
{
$this-> keys = 'Not available';
$this->search_engine = 'Unknown';
}
return array(
$this->referer,
(!is_array($this->keys) ? $this->keys : $this->keys[1]),
$this->search_engine
);
}
return array();
}
}
?>
index.php
index.php
<?php
require_once('./pcboxsearch.class.php');
$keys =& new search_keywords();
$keys = $keys->get_keys();
$url ='a href="http://www.pcboxsearch.com/search.php?q="';
if (count($keys))
{
echo "You're directed to this page from <b>$keys[2]</b> search engine, within Keywords <b>$url$keys[1]</a> </b> If you Like Pcboxsearch Found You search<br>";
}
?>
输出代码index.php
您是通过"google"搜索引擎转到此页面的,该页面位于关键字"code poject"中.如果您喜欢Pcboxsearch,则搜索到
我尝试过此关键字不响应
$ url =''href ="http://www.pcboxsearch.com/search.php?q=''+ $ keys [1];
问题
如何组合找到的关键字使url
例如,如果找到项目代码",则成为url = http://www.pcboxsearch.com/search.php?q=code项目项目
因为我的代码没有响应关键字"http://www.pcboxsearch.com/search.php?q="
您能帮我从哪里加入我的搜索引擎
output code index.php
You''re directed to this page from "google" search engine, within Keywords "code poject" If you Like Pcboxsearch Found You search
I''ve tried this keyword not respont
$url =''href="http://www.pcboxsearch.com/search.php?q=''+ $keys[1];
questions
how to combine keywords found make url
example, if found "projec code" becomes url = http://www.pcboxsearch.com/search.php?q=code projec
because me code not response keyword "http://www.pcboxsearch.com/search.php?q="
Can you help me where do I join as a url into my search engine
推荐答案
referer ; var
referer; var
search_engine ; var
search_engine; var
键; var
keys; var
这篇关于帮我自动导向关键字搜索引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!