BASIC

Author Topic: OpenFeint leaderboards in php  (Read 2670 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10638
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
OpenFeint leaderboards in php
« 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);
?>
 
« Last Edit: 2013-May-30 by Schranz0r »

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: OpenFeint leaderboards in php
« Reply #1 on: 2010-Oct-12 »
Very nice.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1538
    • View Profile
Re: OpenFeint leaderboards in php
« Reply #2 on: 2010-Oct-12 »
Oh that is cool!