i漂泊

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 4167|回复: 0

检测Alexa排名

[复制链接]
TA的礼物信息
  • 收到:0
  • 送出:2
发表于 2013-3-19 09:28:53 | 显示全部楼层 |阅读模式
  1. <?php

  2. $domain = "http://www.baidu.com";

  3. if(!empty($domain)){
  4.    
  5.     $url = trim($domain);

  6.     $a ="http://data.alexa.com/data?cli=10&&url=".$url;

  7. $string= file_get_contents("$a");

  8. echo "<table color='#FFFFFF' align="center"><tr><td>";

  9. $pat3= "/URL="(.+)" TEXT="(.+)"/i";

  10. preg_match_all($pat3, $string, $array);
  11. print_r($array);exit;
  12. if(empty($array[2][0])){

  13. echo "<strong>alexa: no data</strong>   ";

  14. } else {

  15. echo " <strong>世界排名:</strong> 第 <span>".($array[2][0])." </span>名   ";

  16. }

  17. $pat6= "/RANK DELTA="(.+)"/i";

  18. preg_match($pat6, $string, $array);

  19. echo "<strong>名次浮动:</strong> <span>".($array[1])."</span> 名   ";

  20. $pat5= "/LINKSIN NUM="(.+)"/i";

  21. preg_match($pat5, $string, $array);

  22. echo "<strong>外部链接:</strong> <a style="_0color: #ff0000";"href=""http://www.alexa.com/data/ds/linksin?q=link:".$domain.&" target=""_blank"">".($array[1])."</a>";

  23. $pat7="/DATE="(.+)" DAY="(.+)" MONTH="(.+)" YEAR="(.+)"/i";

  24. preg_match_all($pat7, $string, $array);

  25. echo "<strong>收录时间:</strong> <span>".($array[4][0])."</span>年<span>".($array[3][0])."</span>月<span>".($array[2][0])."</span>日   ";

  26. $pat9="/CAT ID="(.+)" TITLE="(.+)" CID="(.+)"/i";

  27. preg_match_all($pat9, $string, $array);

  28. if(empty($array[1][0])){

  29. echo "<strong>收录目录:</strong> <span>未被DMOZ收录</span>";

  30. } else {

  31. echo  "<strong>收录目录:</strong> <span>".($array[1][0])."</span>";

  32. }

  33. echo "</td></tr></table>";

  34. die();

  35. }

  36. ?>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|IPiaoBo Inc. ( 渝ICP备17002826号 )

GMT+8, 2024-5-5 20:34 , Processed in 0.053849 second(s), 56 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表