Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Guildwars Ladder RSS
Plannb23 (Guild Admin) 4/11/2006 5:00 AM EST : Guildwars Ladder RSS
Plannb23
Posts: 1277
Zomgawsh Poster

It seems that Aaron has disabled this script because it timed out and I am really trying to get this up and running. I would appreciate anyone who has the skills to look this over or perhaps Aaron or Sandy will look at this.

I got the source from XML RSS Feed

<?php
  
if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource']))
  {
    
highlight_file(__FILE__);
    die();
  }
  
$cols $_GET['cols'];
  if ((
$cols <= 0) || ($cols 127)) {
    
$cols 127;
  }
  
$page $_GET['page'];
  if ((
$page 1) || ($page 50)) {
    
$page 1;
  }
  
$url "http://ladder.guildwars.com/ladder.dll?ladder=main&page=" . --$page "&sort=rank&order=asc";
  
$url_link "http://ladder.guildwars.com";
  
$author "support@guildwars.com (ArenaNet)";

  
$data Scrape_URL($url);
  
preg_match_all ("/<TR CLASS=\"ladderRank[AB]\">([^`]*?)<\/TR>/"$data$matches);

  
header ("Content-Type: text/xml; charset=UTF-8");
  echo 
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
?>

<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<channel>
<title>Guild Wars :: Guild Ladder</title>
<link><? echo $url_link?></link>
<description>Guild Wars Guild Ladder RSS scrape.</description>
<language>en-us</language>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>gw_guild_ladder.php v0.12 by eugaet</generator>
<managingEditor>support@guildwars.com (ArenaNet)</managingEditor>
<webMaster>eugaet@gmail.com (eugaet)</webMaster>

<?
$title 
"";
$a $cols;
$i 0;
foreach (
$matches[0] as $match) {
  
preg_match_all("/<TD[^<>]+>([^`]*?)<\/TD>/"$match$ranks);
  foreach (
$ranks[1] as $rank) {
    if (
$a == 1) {
      switch (
$i) {
        case 
0:
          
$title sprintf("%02s"ereg_replace("[^0-9]"""strip_tags($rank))) . ": "
          break;
        case 
2:
          
$title $title "[" strip_tags($rank) . "] ";
          break;
    case 
3:
      
$title $title "(" strip_tags($rank) . ") ";
      break;
    case 
4:
      
$title $title strip_tags($rank);
          
$slash 1;
          break;
    case 
5:
      if (
$slash == 1)
        
$title $title "/";
      
$title $title strip_tags($rank);
      
$slash 1;
      break;
    case 
6:
          if (
$slash == 1)
        
$title $title "/";
      
$title $title strip_tags($rank);
          break;
        default:
          
$title $title strip_tags($rank) . " ";
      }
    }
    
$i += 1;
    
$a >>= 1;
  }
  
$i 0;
  
$a $cols;
  
$slash 0;
  if (!(
$title == ''))
  {
    
Build_Item($title$url_link""""$author);
  }
  
$title "";
}
?>

</channel>
</rss>

<?
  
function Scrape_URL($url)
  {
    
$this->content="";
    
$ch curl_init ();
    
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt ($chCURLOPT_URL$url);
    
curl_setopt ($chCURLOPT_TIMEOUT60);
    
$this->content curl_exec ($ch);
    
curl_close ($ch);
    return 
$this->content;
  }

  function 
Build_Item($title$url$description$content$author)
  {
    echo 
"<item>\n";
    echo 
"\t\t\t<title>" $title "</title>\n";
    echo 
"\t\t\t<link>" $url "</link>\n";
    echo 
"\t\t\t<description>" $description "</description>\n";
    echo 
"\t\t\t<content:encoded><![CDATA[ \n";
    echo 
$content "\n";
    echo 
" ]]></content:encoded>\n";
    
//echo "\t\t\t<pubDate>" . date("D, d F Y G:i:s T", strtotime($pubdate)) . "</pubDate>\n";
    
echo "\t\t\t<author>" $author "</author>\n";
    echo 
"\t\t</item>\n";
  }
?>

TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%