All pastes #775781 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-15 18:52 UTC
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);
            $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;
            
        }