PHP+Ajax 網(wǎng)站SEO查詢工具 提供代碼第2/3頁
更新時(shí)間:2007年03月26日 00:00:00 作者:
function.php
復(fù)制代碼 代碼如下:
<?php
# Name: PHP+Ajax 網(wǎng)站SEO查詢工具
# Author: 年華<nianhua.liu@gmail.com> [Q:4908220]
# Notice: Use It After READ readme.txt
# (c) 2007 www.master8.net
defined('IN_SEO') or exit('Access Denied');
function get_seo_info($domain, $bot)
{
global $ROBOT;
if(!array_key_exists($bot, $ROBOT)) return 'Invalid Robot';
$content = '';
$site_info = '';
$link_info = '';
$content = get_content($ROBOT[$bot]['site_url'].$domain);
if(empty($content)) return 'Unkown Error...';
if(preg_match($ROBOT[$bot]['site_pattern'], $content, $matches)) $site_info = $matches[1];
$content = get_content($ROBOT[$bot]['link_url'].$domain);
if(preg_match($ROBOT[$bot]['link_pattern'], $content, $matches)) $link_info = $matches[1];
return $ROBOT[$bot]['name'].' 收錄: <a href="'.$ROBOT[$bot]['site_url'].$domain.'" target="_blank">'.$site_info.'</a> 反向鏈接: <a href="'.$ROBOT[$bot]['link_url'].$domain.'" target="_blank">'.$link_info.'</a>';
}
function sogouRank($domain)
{
$rank = '';
$pr = 0;
$content = get_content('http://www.sogou.com/web?query='.$domain);
if(preg_match("/<\/span>([0-9]{1,})<\/dd>/", $content, $matches))
{
$pr = intval($matches[1]);
$width = ceil(65*$pr/100);
$rank = '<img src="./images/sg_left.gif" width="2" height="11" /><img src="./images/sg_left_img.gif" width="'.$width.'" height="11" /><img src="./images/sg_right_img.gif" width="'.(65-$width).'" height="11" /><img src="./images/sg_right.gif" width="2" height="11" />';
}
$rank = '<a .$pr;
return $rank;
}
function ChinaRank($domain)
{
$rank = '';
$content = get_content('http://www.chinarank.org.cn/detail/Info.do?url='.$domain);
if(preg_match("/<strong>排名<\/strong>(.*)<\/tr>/", $content, $matches))
{
$p = trim(str_replace('</td>', '', $matches[1]));
$p = explode("<td>", $p);
if(isset($p[1])) $rank.= ' 今日:'.$p[1];
if(isset($p[2])) $rank.= ' 本周:'.$p[2];
if(isset($p[3])) $rank.= ' 三月:'.$p[3];
}
$rank = '<a ;
return $rank;
}
function Alexa($domain)
{
$alexa = '';
$content = get_content('http://www.alexa.com/data/details/traffic_details?url='.$domain);
if(preg_match("/3 mos. Change([\s\S]*?)<\/table>/", $content, $matches))
{
$change = strpos($matches[1], 'down_arrow.gif') ? '下降' : '上升';
$p = strip_tags($matches[1], '<td>');
$p = trim(str_replace(array(" ", "\n", "</td>"), array('', '', ''), $p));
$p = explode("<td>", $p);
if(isset($p[1])) $alexa.= ' 今日:'.$p[1];
if(isset($p[2])) $alexa.= ' 本周:'.$p[2];
if(isset($p[3])) $alexa.= ' 本月:'.$p[3];
if(isset($p[4])) $alexa.= ' '.$change.':'.$p[4];
}
if(preg_match("/Review for $domain:<\/span> (.*)<br>/", $content, $matches))
{
$alexa = $alexa.' 等級(jí):'.$matches[1];
}
$alexa = '<a ;
return $alexa;
}
function is_domain($domain)
{
if(preg_match("/^([0-9a-z\-]{1,}\.)?[0-9a-z\-]{2,}\.([0-9a-z\-]{2,}\.)?[a-z]{2,}$/i", $domain))
{
return true;
}
else
{
return false;
}
}
function get_content($url)
{
if(!strpos($url, '://')) return 'Invalid URI';
$content = '';
if(ini_get('allow_url_fopen'))
{
$content = file_get_contents($url);
}
elseif(function_exists('curl_init'))
{
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 0);
$content = curl_exec($handle);
curl_close($handle);
}
elseif(function_exists('fsockopen'))
{
$urlinfo = parse_url($url);
$host = $urlinfo['host'];
$str = explode($host, $url);
$uri = $str[1];
unset($urlinfo, $str);
$content = '';
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if(!$fp)
{
$content = 'Can Not Open Socket...';
}
else
{
$out = "GET $uri HTTP/1.1\r\n";
$out.= "Host: $host \r\n";
$out.= "Accept: */*\r\n";
$out.= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out.= "Connection: Close\r\n\r\n";
fputs($fp, $out);
while (!feof($fp))
{
$content .= fgets($fp, 4069);
}
fclose($fp);
}
}
if(empty($content)) $content = 'Can Not Open Url, Please Check You Server ... <br/>For More Information, Please Visit www.master8.net';
return $content;
}
function PageRank($domain)
{
$result = get_content('http://www.google.com/search?client=navclient-auto&ch=6'. GCH(strord('info:' . $domain)) . '&ie=UTF-8&oe=UTF-8&features=Rank&q=info:' . urlencode($domain));
if (preg_match('/\d+:\d+:(\d+)/', $result, $matches))
{
return intval($matches[1]);
}
else
{
return 0;
}
}
function strord($string)
{
$strlen = strlen($string);
for($i = 0; $i < $strlen; $i++)
{
$result[$i] = ord($string{$i});
}
return $result;
}
function GCH($url, $length=null)
{
$length = sizeof($url);
$a = $b = 0x9E3779B9;
$c = 0xE6359A60;
$k = 0;
$len = $length;
while($len >= 12)
{
$a += ($url[$k + 0] + ($url[$k + 1] << 8) + ($url[$k + 2] << 16) + ($url[$k + 3] << 24));
$b += ($url[$k + 4] + ($url[$k + 5] << 8) + ($url[$k + 6] << 16) + ($url[$k + 7] << 24));
$c += ($url[$k + 8] + ($url[$k + 9] << 8) + ($url[$k + 10] << 16) + ($url[$k + 11] << 24));
$mix = mix($a, $b, $c);
$a = $mix[0];
$b = $mix[1];
$c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len) {
case 11: $c += ($url[$k + 10] << 24);
case 10: $c += ($url[$k + 9] << 16);
case 9 : $c += ($url[$k + 8] << 8);
case 8 : $b += ($url[$k + 7] << 24);
case 7 : $b += ($url[$k + 6] << 16);
case 6 : $b += ($url[$k + 5] << 8);
case 5 : $b += ($url[$k + 4]);
case 4 : $a += ($url[$k + 3] << 24);
case 3 : $a += ($url[$k + 2] << 16);
case 2 : $a += ($url[$k + 1] << 8);
case 1 : $a += ($url[$k + 0]);
}
$mix = mix($a, $b, $c);
return $mix[2];
}
function mix($a, $b, $c)
{
$a -= $b;
$a -= $c;
$a ^= (zeroFill($c, 13));
$b -= $c;
$b -= $a;
$b ^= ($a << 8);
$c -= $a;
$c -= $b;
$c ^= (zeroFill($b, 13));
$a -= $b;
$a -= $c;
$a ^= (zeroFill($c, 12));
$b -= $c;
$b -= $a;
$b ^= ($a << 16);
$c -= $a;
$c -= $b;
$c ^= (zeroFill($b, 5));
$a -= $b;
$a -= $c;
$a ^= (zeroFill($c, 3));
$b -= $c;
$b -= $a;
$b ^= ($a << 10);
$c -= $a;
$c -= $b;
$c ^= (zeroFill($b, 15));
return array($a, $b, $c);
}
function zeroFill($a, $b)
{
$z = hexdec(80000000);
if($z & $a)
{
$a = ($a >> 1);
$a &= (~ $z);
$a |= 0x40000000;
$a = ($a >> ($b - 1));
}
else
{
$a = ($a>>$b);
}
return $a;
}
?>
robot.php
復(fù)制代碼 代碼如下:
<?php
# Name: PHP+Ajax 網(wǎng)站SEO查詢工具
# Author: 年華<nianhua.liu@gmail.com> [Q:4908220]
# Notice: Use It After READ readme.txt
# (c) 2007 www.master8.net
defined('IN_SEO') or exit('Access Denied');
$ROBOT['google']['name'] = 'Google';
$ROBOT['google']['site_url'] = 'http://www.google.com/search?hl=zh-CN&q=site%3A';
$ROBOT['google']['site_pattern'] = "/上約有 <b>(.*)<\/b> 項(xiàng)符合/";
$ROBOT['google']['link_url'] = 'http://www.google.com/search?hl=zh-CN&q=link%3A';
$ROBOT['google']['link_pattern'] = "/約有 <b>(.*)<\/b> 項(xiàng)鏈接到/";
$ROBOT['baidu']['name'] = '百度';
$ROBOT['baidu']['site_url'] = 'http://www.baidu.com/s?wd=site%3A';
$ROBOT['baidu']['site_pattern'] = "/找到相關(guān)網(wǎng)頁約(.*)篇/";
$ROBOT['baidu']['link_url'] = 'http://www.baidu.com/s?wd=domain%3A';
$ROBOT['baidu']['link_pattern'] = "/找到相關(guān)網(wǎng)頁約(.*)篇/";
$ROBOT['yahoo']['name'] = 'Yahoo';
$ROBOT['yahoo']['site_url'] = 'http://search.cn.yahoo.com/search?p=site%3A';
$ROBOT['yahoo']['site_pattern'] = "/共返回約 <strong>(.*)<\/strong> 項(xiàng)/";
$ROBOT['yahoo']['link_url'] = 'http://search.cn.yahoo.com/search?p=linkdomain%3A';
$ROBOT['yahoo']['link_pattern'] = "/共返回約 <strong>(.*)<\/strong> 項(xiàng)/";
$ROBOT['sogou']['name'] = '搜狗';
$ROBOT['sogou']['site_url'] = 'http://www.sogou.com/web?query=site%3A';
$ROBOT['sogou']['site_pattern'] = "/找到 (.*) 個(gè)網(wǎng)頁/";
$ROBOT['sogou']['link_url'] = 'http://www.sogou.com/web?query=link%3A';
$ROBOT['sogou']['link_pattern'] = "/找到 (.*) 個(gè)網(wǎng)頁/";
$ROBOT['iask']['name'] = '新浪';
$ROBOT['iask']['site_url'] = 'http://www.iask.com/w?k=site%3A';
$ROBOT['iask']['site_pattern'] = "/找到 <span class=\"ar\">(.*)<\/span> 篇網(wǎng)頁/";
$ROBOT['iask']['link_url'] = 'http://www.iask.com/w?k=domain%3A';
$ROBOT['iask']['link_pattern'] = "/找到 <span class=\"ar\">(.*)<\/span> 篇網(wǎng)頁/";
$ROBOT['msn']['name'] = 'MSN';
$ROBOT['msn']['site_url'] = 'http://search.msn.com/results.aspx?q=site%3A';
$ROBOT['msn']['site_pattern'] = "/<h5>Page 1 of (.*)results<\/h5>/";
$ROBOT['msn']['link_url'] = 'http://search.msn.com/results.aspx?q=link%3A';
$ROBOT['msn']['link_pattern'] = "/<h5>Page 1 of (.*)results<\/h5>/";
$ROBOT['so163']['name'] = '網(wǎng)易';
$ROBOT['so163']['site_url'] = 'http://cha.so.163.com/so.php?q=site%3A';
$ROBOT['so163']['site_pattern'] = "/共<\/span><SPAN class=black5> (.*) <\/span>/";
$ROBOT['so163']['link_url'] = 'http://cha.so.163.com/so.php?q=link%3A';
$ROBOT['so163']['link_pattern'] = "/共<\/span><SPAN class=black5> (.*) <\/span>/";
$ROBOT['zhongsou']['name'] = '中搜';
$ROBOT['zhongsou']['site_url'] = 'http://p.zhongsou.com/p?w=site%3A';
$ROBOT['zhongsou']['site_pattern'] = "/找到(.*)條結(jié)果/";
$ROBOT['zhongsou']['link_url'] = 'http://p.zhongsou.com/p?w=link%3A';
$ROBOT['zhongsou']['link_pattern'] = "/找到(.*)條結(jié)果/";
$ROBOT['vnet']['name'] = '電信114';
$ROBOT['vnet']['site_url'] = 'http://search.114.vnet.cn/search_web.html?kw=site%3A';
$ROBOT['vnet']['site_pattern'] = "/共搜到約(.*)個(gè)網(wǎng)頁/";
$ROBOT['vnet']['link_url'] = 'http://search.114.vnet.cn/search_web.html?kw=link%3A';
$ROBOT['vnet']['link_pattern'] = "/共搜到約(.*)個(gè)網(wǎng)頁/";
?>
相關(guān)文章
PHP文件上傳、客戶端和服務(wù)器端加限制、抓取錯(cuò)誤信息、完整步驟解析
文件上傳分為兩個(gè)部分,HTML顯示部分和PHP處理部分。這篇文章主要介紹了PHP文件上傳、客戶端和服務(wù)器端加限制、抓取錯(cuò)誤信息、完整步驟解析,需要的朋友參考下吧2017-01-01分享PHP源碼批量抓取遠(yuǎn)程網(wǎng)頁圖片并保存到本地的實(shí)現(xiàn)方法
本篇文章給大家分享PHP源碼批量抓取遠(yuǎn)程網(wǎng)頁圖片并保存到本地的實(shí)現(xiàn)方法,對批量抓取網(wǎng)頁圖片相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2015-12-12關(guān)于二級(jí)目錄拖拽排序的實(shí)現(xiàn)(源碼示例下載)
本篇文章介紹了,關(guān)于二級(jí)目錄拖拽排序的實(shí)現(xiàn)(源碼示例下載)。需要的朋友參考下2013-04-04laravel 時(shí)間格式轉(zhuǎn)時(shí)間戳的例子
今天小編就為大家分享一篇laravel 時(shí)間格式轉(zhuǎn)時(shí)間戳的例子,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-10-10yii2中的rules 自定義驗(yàn)證規(guī)則詳解
yii2的一個(gè)強(qiáng)大之處之一就是他的Form組件,既方便又安全。本文給大家介紹yii2中的rules 自定義驗(yàn)證規(guī)則,需要的朋友參考下2016-04-04