All pastes #897530 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-02-09 17:06 UTC
rendered paste body
            function get_snapshot_data ($gamertag) {
                
                /*
                ** Function: get_snapshot_data
                ** Description: Get's a player's data from their player snapshot.
                ** Param $gamertag STRING The user's gamertag.
                ** Author: Clooth
                **
                ** Fetches:
                **     Total games played
                **     Experience
                **     Et cetera
                */
    
                $username = urlencode( $gamertag );
                $source = $this->curl("http://www.bungie.net/stats/halo3/default.aspx?player={$username}");
                $source2 = $this->get_between('<table class="profile_strip_tableB" style="float:left;">', '<div class="clear"></div>', $source);
                $source2 = explode("\n", $source2);

                $info = array();
                for( $i = 0; $i<count($source2); $i++ )
                {
                    if( stristr($source2[$i], '<td>') )
                    {
                        $current = $this->get_between('<td>', '</td>', $source2[$i]);
                        $info[$current] = $this->get_between('<td class="values">', '</td>', $source2[$i+1]);
                    }
                    else { continue; }
                }

                $info['Picture'] = 'http://www.bungie.net/stats/halo3/' . $this->get_between('<div class="model"><img id="ctl00_mainContent_imgModel" src="', '" style="border-width: 0px;"></div>', $source);

                return $info;
    
            }