当前位置:Gxlcms > PHP教程 > PHP+Ajax网站SEO查询工具提供代码第1/3页_PHP教程

PHP+Ajax网站SEO查询工具提供代码第1/3页_PHP教程

时间:2021-07-01 10:21:17 帮助过:9人阅读

# Name: PHP+Ajax 网站SEO查询工具
# Author: 年华 [Q:4908220]
# Homepage:http://master8.net
使用说明:
1.服务器必须至少支持allow_url_fopen,curl,fsockopen中的一种,具体请咨询服务器管理员。
2.请尊重别人的劳动成果!你可以任意修改并使用此程序,但不允许修改后公开发布!传播此程序亦应保持此压缩包完整性!
3.如果在使用中遇到任何问题,请访问http://master8.net/bbs/提出以便得到解决。
ajax.js
代码如下:
// Name: PHP+Ajax 网站SEO查询工具
// Author: 年华 [Q:4908220]
// Notice: Use It After READ readme.txt
// (c) 2007 www.master8.net
var xmlHttp;
function makeRequest(queryString) {
var msXml = new Array();
msXml[0] = "Microsoft.XMLHTTP";
msXml[1] = "MSXML2.XMLHTTP.5.0";
msXml[2] = "MSXML2.XMLHTTP.4.0";
msXml[3] = "MSXML2.XMLHTTP.3.0";
msXml[4] = "MSXML2.XMLHTTP";
if (window.xmlHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
for (var i = 0; i < msXml.length; i++) {
try {
xmlHttp = new ActiveXObject(msXml[i]);
break;
} catch (e) {
xmlHttp = new xmlHttpRequest();
}
}
}
xmlHttp.onreadystatechange = getRequest;
xmlHttp.open('post', 'seo.php', true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send(queryString);
}
function getRequest() {
if(xmlHttp.readyState==4) {
if(xmlHttp.status==200) {
$('seo_result').innerHTML = xmlHttp.responseText;
}
}
}

seo.php
代码如下:
# Name: PHP+Ajax 网站SEO查询工具
# Author: 年华 [Q:4908220]
# Notice: Use It After READ readme.txt
# (c) 2007 www.master8.net
define('IN_SEO', TRUE);
error_reporting(E_ERROR);
set_time_limit(0);
isset($_SERVER['HTTP_REFERER']) or exit('Invalid Request');
preg_match("/".$_SERVER['HTTP_HOST']."/i", $_SERVER['HTTP_REFERER']) or exit('Access Denied');
header("Content-Type:text/html;charset=gb2312");
include './robot.php';
require './function.php';
@extract($_POST);
isset($job) && isset($domain) or exit('Invalid Request');
$domain = strtolower($domain);
is_domain($domain) or exit('Invalid Domain');
$jobs=array('google','baidu','yahoo','msn','sogou','iask','so163','zhongsou','vnet');
$result = '';
if(in_array($job, $jobs))
{
$result = get_seo_info($domain, $job);
}
elseif($job == 'alexa')
{
$result = Alexa($domain);
}
elseif($job == 'chinarank')
{
$result = ChinaRank($domain);
}
elseif($job == 'pagerank')
{
$result = ' '.$domain;
if(substr($domain, 0, 4) == 'www.')
{
$domain = substr($domain, 4);
$result.= ' '.$domain;
}
}
elseif($job == 'sogourank')
{
$result = sogouRank($domain).' '.$domain;
if(substr($domain, 0, 4) == 'www.')
{
$domain = str_replace("www.", '', $domain);
$result = $result.' '.sogouRank($domain).' '.$domain;
}
}
!empty($result) or exit('Invalid Request');
echo ' '.$result;
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/318248.htmlTechArticle#Name:PHP+Ajax网站SEO查询工具 #Author:年华nianhua.liu@gmail.com[Q:4908220] #Homepage:http://master8.net 使用说明: 1.服务器必须至少支持allow_url_fopen,curl,fsock...

人气教程排行