GLBasic forum

Codesnippets => Network => Topic started by: Kitty Hello on 2010-Aug-09

Title: OpenFeint leaderboards in php
Post by: Kitty Hello on 2010-Aug-09
Code: (glbasic) [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="de">
<head>
<title>Leaderboard</title>
<!--[if lte IE 6]><META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.timo-ernst.net/stop-the-ie6/de"><![endif]-->
        <meta http-equiv="Content-Type" content="text/html" >
</head>
<body>


<?php
// test (Where is the Cheese): http://www.GLBasic.com/highscores/openfeint.php?game=67994&list=212553

$game $_GET['game'];
$list $_GET['list'];
$login 'yourmail%40yourdomain.com';
$password 'yourpassword_to_OF';
$xml simplexml_load_file('https://'.$login.':'.$password.'@api.openfeint.com/api/games/'.$game.'/leaderboards/'.$list.'/highscores.xml');

echo '<table>';
for($is 0$isc=count($xml->highscore); $is<min(20$isc); ++$is)
{
$hs = &$xml->highscore[$is];
if( $is 2)
{
echo '<tr style="background-color: #ccffcc;"><td>';
}
else
{
echo '<tr style="background-color: #ffffcc;"><td>';
}
echo $hs->user->name '</td><td>'.$hs->score."</td></tr>\n";
// var_dump($hs);
}
echo '</table></body>';
  
// var_dump($xml);
?>

Title: Re: OpenFeint leaderboards in php
Post by: Moebius on 2010-Oct-12
Very nice.
Title: Re: OpenFeint leaderboards in php
Post by: matchy on 2010-Oct-12
Oh that is cool!