[php]代码库
<?php
$url = trim($_GET["domain"]);
$string= file_get_contents("http://data.alexa.com/data/+wQ411en8000lA?cli=10&dat=s&ver=7.0&url=$url");
$string=iconv("UTF-8","GB2312",$string);
header("content-Type: text/html; charset=GB2312");
echo "<table color='#FFFFFF'><tr><td>";
$pat3= "/URL=\"(.+)\" TEXT=\"(.+)\"/i";
preg_match_all($pat3, $string, $array);
if(empty($array[2][0])){echo "<b>alexa: no data</b> ";}
else{
echo " <b>世界排名: 第".($array[2][0])." 名</b> ";}
$pat6= "/RANK DELTA=\"(.+)\"/i";
preg_match($pat6, $string, $array);
echo "名次浮动: ".($array[1])."名 ";
$pat5= "/LINKSIN NUM=\"(.+)\"/i";
preg_match($pat5, $string, $array);
echo "外部链接: ".($array[1])."个<br>";
?>