Just thought I would share this out there with any other developers using scoreoid and looking for an easy way to display your online leaderboards on your website! If you know a lot about java and php and parsing json and xml, you probably have no need for this.. But not everyone is up to date on that , and scoreoids own docs on the subject were more than a little lacking.. So I thought would share this simple PHP script to get you started and save you from some of the headaches I had.. 


echo "Scores:<BR><BR>";

$api = "your api code";
$game = "your game id";
$response = "XML";
$orderby = "score";
$order = "desc";
$limit = 100;

$url = 'https://www.scoreoid.com/api/getScores?api_key='.$api.'&game_id='.$game.'&response='.$response.'&order_by='.$orderby.'&order='.$order.'&limit='.$limit;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);    // get the url contents

$data = curl_exec($ch); // execute curl request
curl_close($ch);

$xml = simplexml_load_string($data);

foreach($xml->player as $player)
{
	echo $player['username'];
	echo " -- ";
	echo $player['email'];
	echo " -- ";
	echo $player['first_name'];
	echo " -- ";
	echo $player['last_name'];
	echo " -- ";
	echo $player['platform'];
	echo " -- ";
	
	echo $player->score["score"];
	echo " -- ";
	echo $player->score["difficulty"];
	echo " -- ";
	echo $player->score["platform"];
	echo " -- ";
	echo $player->score["leaderboard"];
	echo " -- ";
	echo $player->score["created"];
	echo " -- ";
	echo $player->score["data"];
	echo "<br><br>";
}

// to see the raw simple xml, uncomment below
//print_r($xml)

Thats all folks! Hope it helps someone out there! Time for me to get back to working on my scoreboard pages!