Codesnippets > Network

OpenFeint leaderboards in php

(1/1)

Kitty Hello:

--- Code: GLBasic ---<!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);
?>
 

Moebius:
Very nice.

matchy:
Oh that is cool!

Navigation

[0] Message Index

Go to full version