php 读取 alexa消息
分类:威尼斯手机平台

php 读取 alexa信息

php 读取 sogourank 与 ChinaRank信息

function Alexa($domain){$alexa = '';$content = get_content('_details?url='.$domain);if(preg_match(/3 mos. Change([sS]*?)/table/, $content, $matches)){$change = strpos($matches[1], 'down_arrow.gif') ? '下降' : '上升';$p = strip_tags($matches[1], 'td');$p = trim(str_replace(array(nbsp;, 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.' 等级:'.$matches[1];}$alexa = 'a href=_details?url='.$domain.' target=_blank'.$alexa.'/a';return $alexa;}

function sogouRank($domain){$rank = '';$pr = 0;$content = get_content(''.$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 href=%3A'.$domain.' target=_blank title=搜狗Rank:'.$pr.''.$rank.'/a '.$pr;return $rank;}

function ChinaRank($domain){$rank = '';$content = get_content(''.$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 href='.$domain.' target=_blank'.$rank.'/a';return $rank;}

本文由威尼斯在线注册平台发布于威尼斯手机平台,转载请注明出处:php 读取 alexa消息

上一篇:php实现流量计成效 下一篇:没有了
猜你喜欢
热门排行
精彩图文