bnetProfileLink = $profile; else $this->bnetProfileLink = $profile . '/'; $this->parseProfile(); if($this->profileFound) { $this->parseDivision(); $this->parseMatchHistory(); } } public function getDivisionLink() { return $this->divisionLink; } public function getCharacterName() { return $this->characterName; } public function getCharacterLeague() { return $this->characterLeague; } public function getGamesPlayed() { return $this->gamesPlayed; } public function getGamesWon() { return $this->gamesWon; } public function getBonusPool() { return $this->bonusPool; } public function getDivisionStandings() { return $this->divisionStandings; } public function getMatchHistory($count = 0) { if($count == 0) $count = count($this->matchHistory); return array_slice($this->matchHistory,0,$count); } public function getMaxBonusPool() { return $this->maxBonusPool; } public function getCharacterRating() { return $this->characterRating; } public function getProfileFound() { return $this->profileFound; } private function parseProfile() { $profileHtml = @file($this->bnetProfileLink); if(!$profileHtml) { $this->profileFound = false; return; } $onesFound = false; $divisionFound = false; $characterFound = false; foreach($profileHtml as $profileLine) { if(!$characterFound) { if(preg_match('{}',$profileLine,$characterMatch)) $characterFound = true; } if(preg_match('/#best-team-1/',$profileLine)) $onesFound = true; if(!$onesFound) continue; if(!$divisionFound) { if(preg_match('{a href="(.*)#current-rank">Record: (.*) - (.*)}',$profileLine,$recordMatch)) continue; break; } preg_match('{(http://.*.battle.net)}',$this->bnetProfileLink,$regionMatch); $this->divisionLink = $regionMatch[1] . $divisionMatch[1]; $this->gamesPlayed = $recordMatch[1] + $recordMatch[2]; $this->gamesWon = $recordMatch[1]; $this->characterName = $characterMatch[1]; $this->characterLeague = $divisionMatch[2]; } private function parseDivision() { $divisionStandings = array(); $divisionHtml = file($this->divisionLink); $standingsHtml = array(); $standingsCount = 0; $standingsFound = false; $bonusFound = false; foreach($divisionHtml as $divisionLine) { if(!$bonusFound) { if(preg_match('{Bonus Pool: (.*)}',$divisionLine,$bonusMatch)) $bonusFound = true; } if(preg_match('/