DmdFreak Posted September 25, 2006 Share Posted September 25, 2006 I'm trying to do a file_get_contents() on the following URL then parse the info.http://game.trackmanianations.com/online_game/www_serverslist.phpI want to end up with the server name and each of the players that are on at that moment.I want to then turn around and post this info as live results on my website.[code]- <server> <host>freaksserver2</host> - <players> <player>Fredrik_Smart</player> <player>Susie2002</player> <player>_milllan_</player> <player>BALTAZAR_</player> <player>ZiLWooD</player> <player>Mr._Flips</player> <player>Ayzblokk</player> <player>Rose_Tattoo</player> </players> </server>[/code]When I do the file_get_content() I end up with only the names, but when I insert the same URL straight into the browser, I get a coded active page. If anyone has any idea of another way of getting what I want out of this page it would be great. I'm very new to PHP.Thanks! Quote Link to comment Share on other sites More sharing options...
Barand Posted September 25, 2006 Share Posted September 25, 2006 What version PHP? Quote Link to comment Share on other sites More sharing options...
DmdFreak Posted September 25, 2006 Author Share Posted September 25, 2006 Sorry about that. Version 5 Quote Link to comment Share on other sites More sharing options...
Barand Posted September 26, 2006 Share Posted September 26, 2006 Does this help[code]<?php$xml = simplexml_load_file('http://game.trackmanianations.com/online_game/www_serverslist.php');foreach ($xml as $server) { echo "<h3> ------ $server->host ------ </h3>"; foreach ($server->players as $playerlist) { if ($playerlist->player) foreach ($playerlist->player as $name) { echo $name . '<br/>'; } else echo 'No players<br/>'; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
DmdFreak Posted September 26, 2006 Author Share Posted September 26, 2006 Totally helped! Thanks a bunch! I can edit it from here to list just the servers I want to list. Many many thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.