rendered paste body function get_clan_data ($clan) {
/*
** @name get_clan_data
** @param $c STRING The Runehead identifier of the clan desired.
**
** Returns an array with the clan's total members and XP, and
** average combat level and total level.
** Created by Limetang.
*/
$source = get_page('http://runehead.com/clans/ml.php?clan=' . $clan);
if(strpos($source, "<h1>Memberlist Not Found</h1>") == false)
return false;
else {
$stats = array();
$start = strpos($source, '<title>') + 7;
$stats['Clan Name'] = substr($source, $start, strpos($source, 'Memberlist') - $start);
$start = strpos($source, '<ul>');
$source = substr($source, $start, strpos($source, '</ul>') - $start);
preg_match_all("#<li(?: class='gap')?><b>(.+?):</b> (.+?)</li>#", $source, $tmp, PREG_SET_ORDER);
foreach($tmp as $entry)
$stats[$entry[1]] = $entry[2];
return $stats;
}
}