Mission: modify - cache XML or save file XML
Display All
Display All
Source Code
- function XmlAlliancesTag ($strName, $strUni, $strDomain){
- $url = 'http://s'.$strUni.'-'.$strDomain.'.ogame.gameforge.com/api/players.xml';
- $xml = simplexml_load_file($url);
- foreach ($xml->children() as $players) {
- if ($players['name'] == $strName){
- $allianceID = trim($players['alliance']);
- break;
- }
- }
- $url = 'http://s'.$strUni.'-'.$strDomain.'.ogame.gameforge.com/api/alliances.xml';
- $xml = simplexml_load_file($url);
- foreach ($xml->children() as $alliance) {
- if ($alliance['id'] == $allianceID)
- {
- $varResult = trim($alliance['tag']);
- break;
- }
- }
- return $varResult;
- }
Source Code
- $intTitle = split("vs.", $strReturn);
- $arrAttackers = split(",", $intTitle[0]);
- $arrDefenders = split(",", $intTitle[1]);
- foreach($arrAttackers as $arrPlayer) {
- $arrPlayer = trim($arrPlayer);
- $AllianceTag = XmlAlliancesTag ($arrPlayer, $intUni, $strDomain);
- if ($AllianceTag) $intTitle[0] = str_replace($arrPlayer, '['.$AllianceTag.'] '.$arrPlayer, $intTitle[0]);
- }
- foreach($arrDefenders as $arrPlayer) {
- $arrPlayer = trim($arrPlayer);
- $AllianceTag = XmlAlliancesTag ($arrPlayer, $intUni, $strDomain);
- if ($AllianceTag) $intTitle[1] = str_replace($arrPlayer, '['.$AllianceTag.'] '.$arrPlayer, $intTitle[1]);
- }
- $strReturn = $intTitle[0].' vs. '.$intTitle[1];