1. 您的位置:首页 > seo技术 >内容

广州黑帽站群免费:实现对网站SEO信息类示例的专业访问PHP技能

本文介绍了PHP以实现对网站SEO信息类的专业访问。分享给每个人供您参考。具体如下:

此SEO类的功能包括:
-检查指定的网站响应
-从网站主页获取语言和其他元标签数据
-获取网站's导入链接,从Alexa流量排名
-访问网站's导入链接,Google索引的页数
-从WOT排名中获得网站信任。
-Get,因为它是第一个注册的网站域名年龄
-获得Twitter网站的页数
-获取Facebook链接的网站页面
-获取Google页面的网站速度级别
-获取网站's Google页面排名

<?php/***SEO用于不同指标**@category SEO*@author chema*@copyright(c)2009-2012 Open Classifieds Team*@license GPL v3*基于SEO脚本http://www.phpeasycode.co M&&PHP Class Seostats*/Class seoreport{/****检查URL是否在线/活动*@param字符串$url*@return bool/public static function Is_alive($url){$ch=Curl_init();curl_setopt($ch,Curlopt_url,$url);curl_setopt($ch,Curlopt_binarytransffer,1);curl_setopt($ch,curlopt_headerfunction,'curlheadercallback');curl_setopt($ch,Curlopt_failonerror,1);Curl_exec($ch);$int_return_code=Curl_getinfo($ch,Curlinfo_http_code);Curl_close($ch);if($int_return_code!=&&$int_return_code!=302&&$int_return_code!=304){return falsE否则返回真实;}/***HTTP获取卷曲请求。**@param string$urlString,包含卷曲的URL。*@return字符串返回包含卷曲结果的字符串。**/protected static function get_html($url){$ch=Curl_init($url);curl_setopt($ch,curlopt_returntransfer,1);curl_setopt($ch,curlopt_connectoutout,5);curl_setopt($ch,curlopt_followllocation,1);curl_setopt($ch,curlopt_maxredirs,2);如果(Strtolower(Parse_url($url,php_url_scheme))='https'){curl_setopt($ch,curlopt_ssl_verifypeer,1);curl_setopt($ch,curlopt_ssl_verifyhost,1);}$str=Curl_exec($ch);Curl_close($ch);返回($STR)?$str:错误;/***从任何URL*@param string$URL/public static function domain_name($URL)获取域{$noww=ereg_replace('www \。'',$url);$domain=Parse_url($noww);如果(!空($domain["host"])返回$domain["host"];否则返回$domain[&##34;Path"];}/****从URL和站点的语言获取元*@param string$URL*@return Array*/public static function Meta_info($URL){//dones'在Mediatempl工作E/*$html=new DOMDocument();if(!$html->loadhtmlfile($url))返回false;*/if(!$html_content=self::get_html($url))返回FalsE$html=new DOMDocument();$html->loadhtml($html_content);$xpath=new Domxpath($html);$url_info=Array();$langs=$xpath->query('//html');foreach($langs as$lang){$url _info['language']=$lang->getattribute('lang');$metas=$xpath->query('//meta');foreach($metas as$meta){if($meta->getattribute('name')广州黑帽站群免费{$url_info[$meta->getattribute('name')]=$meta->getattribute('content');}返回$url_info;/***Alexa rank*@param string$url*@return整数/公共静态函数Alexa_rank($url){$d omain=self::d omain_name($url);$reQuest="Http://data.alexa.com/data?cli=10&dat=s&url="。$域;$data=self::get_html($request);Preg_match('/<流行url="(。*?)"Text="([\ d]+)"\/>/si",$data,$p);Return($l[2])?$l[2]:NULL;/***Alexainbounds link*@param string$url*@return整数/公共静态函数Alexa_liNks($url){$d omain=self::d omain_name($url);$request="Http://data.alexa.com/data?cli=10&dat=s&url="。$域;$data=self::get_html($request);Preg_match('/\ si',$data,$l);Return($l[1])?$l[1]:空;/***返回任何Google搜索的结果总量,*请求取消使用的websearch API。**@param string$query string,包含搜索查询。*@return整数返回总数。*/公共静态函数Google_pages($url){//$query=self::d omain_name($url);$url='http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=1&q='。$url;$str=self::get_html($url);$data=Json_decode($STR);返回(!isset($data->responsedata->cursor->estimatedresultcount))?'0':intval($data->responsedata->cursor->estimatedresultcount);}/****获取站点中的inbounds链接*@param string$url*@param整数/公共静态Fu Nction Google_links($url){$request="http://www.google.com/search?q="。URLENCE("链接:"。$url)。"&hl=en";$data=self::get_html($request);Preg_match('/

')?([\ d,]+)Result/si',$data,$l);Return($l[2])?$l[2]:NULL;/****信任等级Web*@param string$url*@reutn整数/公共静态函数Wot_ratinG($url){$d omain=self::d omain_name($url);$request="http://api.mywot.com/0.4/public_query2?目标="。$domain;$data=self::get_htmL($request);Preg_match_all('/<应用程序名称="(\ d+)"r="(\ d+)"c="(\ d+)"\/>/si",$data,$regs);$可信度=($regs[2][0])?$regs[2][0]:NULL;返回(Is_numeric($可信度))?$可信度:空;}/***域名有多大?*@参数string$domain*@return整数unixtime/public static function domain_age($domain){$request="http://reports.internic.net/cgi/whois?whois_nic="。$域。"&type=domain";$data=self::get_html($request);Preg_match('/创建日期:([a-z0-9-]+)/si',$data,$p);返回(!$p[1])?错误:strtotime($p[1]);/****计算有关URL*@param string$URL*@return integer/public static的推文数量函数Tweet_count($url){$url=UrlEncode($url);$twitterEndpoint="http://url.api.twitter.com/1/url/count.json?url=%s";$fileData=file_get_contents(sprintf($twitterEndpoint,$url));$json=json_decode($fileData,true);Unset($fileData);免费内存返回(is_numeric($json['count'])?$json深圳采集站群便宜['Count']:null;}/***返回单页**@链接的Facebook分享总量https://graph.facebook.com/*@param字符串要检查的URL。*@return整数返回Facebook*/公共静态函数Facebook_shares($q){//ex的总量Json$str=self::get html('http://graph.facebook.com/?id='。UrlEncode($q));$data=Json_decode($STR);只返回Facebook分享数量$r=$data->分享;返回($r!=空)?$r:Intval('0');/****获取Page speed rank@param string$url*@return整数/公共静态功能页面_speed($url){$url='https://developers.google.com//apps/pagespeed/run_pagespeed?url='。$url。'&format=json';$str=self::get_html($url);$data=Json_decode($STR);返回Intval($data->Results->score);/***获取Google页面ra NK*@param string$url*@Return整数/公共静态函数Page_ra NK($url){$query="http://toolbarqueries.google.com/tbr?客户端=navclient auto&ch="。Self::checkhash(Self::has HURL($url))。"&features=rank&q=info:"。$url。"&num=100&filter=0";$data=self::get_html($query);//die(Print_r($data));$pos=Strpos($data,"rank");如果($pos==False){return NULL;其他{$pagerank=substr($data,$pos+9);返回$pagerank;}//Google pagerank/***计算PR函数/公共静态函数Strtonum的函数($Str,$Check,$Magic){$Int 32Unit=4294967296;//2 ^ 32$length=strlen($STR);对于($i=0;$i

=$Int 32 unit){$CHeck=($Check-$Int 32Unit*(Int)($Check/$Int 32Unit));如果检查小于-2 ^ 31$Check=($Check<2147483648)?($Check+$Int 32Unit):$Check;$Check++ord($Str{$i});返回$Check;}/***Genearate URL/公共静态函数Hashurl($String){$Check 1=self::strtonum的散列($字符串,0x1505,0x21);$Check 2=self::strtonum($String,0,0x1003f);$Check 1>>=2;$Check 1=($Check 1>>4)&0x3ffffc0)|($Check 1&0x3F);$Check 1=($Check 1>>4)&0x3ffc00)|($Check 1&0x3ff);$Check 1=($Check 1>>4)&0x3c000)|($Check 1&0x3fff);$T 1=(($Check 1&0x3c0)

=0;$i-){$Re=$HashStr{$i};如果(1==($Flag%2)){$Re+=$Re;$Re=(int)($Re/10)+($Re%10);}$CheckByte+=$Re;$Flag++;}$CheckByte%=10;如果(0!==$CheckByte){$CheckByte=10-$CheckByte;if(1==($Flag%2)){if(1==($CheckByte%2)){$CheckByte=9;}$CheckByte>>=1;返回'7'$CheckByte。$HashStr;}}

使用示例

<?php包括'seoreport.php';Ini_set('Max_execution_time',180);$url=(isset($_get['url')?$_get['url':'http://phpclasses.org';$meta_tags=Seoreport::meta_info($url);死亡(Var_dump($meta_tags));If网站在线If($meta_tags!==false){$stats=array();$stats['meta']=$meta_tags;$stats[&'Alexa']['rank']=Seoreport::Alexa_rank($url);$stats[&'Alexa']['links']=Seoreport::Alexa_links($url);$stats[&'domain']['wot_rating']=seoreport::wot_rating($url);$stats[&'d omain']['domain_age']=Seoreport::d omain_age($url);$stats[&'Social']['Twitter']=Seoreport::tweet_count($url);$stats[&'Social']['Facebook']=Seoreport::Facebook_shares($url);$stats[&'Google']['p age_rank']=Seoreport::p age_rank($url);$stats[&'Google']['p age_speed']=Seoreport::p age_speed($url);$stats[&'Google']['pages']=seoreport::Google_pages($url);$stats[&'Google']['links']=Seoreport::Google_links($url);Var_dump($stats);Else'网站不在线。'. $url;<35>

我希望本文将帮助您进行PHP编程。

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。如若转载,请注明出处:http://www.botadmin.cn/sylc/4756.html