Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2015, 09:49
Avatar de fbedia
fbedia
 
Fecha de Ingreso: julio-2010
Mensajes: 159
Antigüedad: 13 años, 9 meses
Puntos: 8
Instalar LightOpenID

Hola!
Estoy comenzando a trabajar con el API de Steam: http://steamcommunity.com/dev/
He visto el siguiente ejemplo de LOGIN:

Código PHP:
Ver original
  1. <?php
  2. require 'includes/lightopenid/openid.php';
  3. $_STEAMAPI = "YOURSTEAMAPIKEY";
  4. try
  5. {
  6.     $openid = new LightOpenID('http://URL.TO.REDIRECT.TO.AFTER.LOGIN/');
  7.     if(!$openid->mode)
  8.     {
  9.         if(isset($_GET['login']))
  10.         {
  11.             $openid->identity = 'http://steamcommunity.com/openid/?l=english';    // This is forcing english because it has a weird habit of selecting a random language otherwise
  12.             header('Location: ' . $openid->authUrl());
  13.         }
  14. ?>
  15. <form action="?login" method="post">
  16.     <input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png">
  17. </form>
  18. <?php
  19.     }
  20.     elseif($openid->mode == 'cancel')
  21.     {
  22.         echo 'User has canceled authentication!';
  23.     }
  24.     else
  25.     {
  26.         if($openid->validate())
  27.         {
  28.                 $id = $openid->identity;
  29.                 // identity is something like: http://steamcommunity.com/openid/id/76561197960435530
  30.                 // we only care about the unique account ID at the end of the URL.
  31.                 $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
  32.                 preg_match($ptn, $id, $matches);
  33.                 echo "User is logged in (steamID: $matches[1])\n";
  34.  
  35.                 $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$_STEAMAPI&steamids=$matches[1]";
  36.                 $json_object= file_get_contents($url);
  37.                 $json_decoded = json_decode($json_object);
  38.  
  39.                 foreach ($json_decoded->response->players as $player)
  40.                 {
  41.                     echo "
  42.                    <br/>Player ID: $player->steamid
  43.                    <br/>Player Name: $player->personaname
  44.                    <br/>Profile URL: $player->profileurl
  45.                    <br/>SmallAvatar: <img src='$player->avatar'/>
  46.                    <br/>MediumAvatar: <img src='$player->avatarmedium'/>
  47.                    <br/>LargeAvatar: <img src='$player->avatarfull'/>
  48.                    ";
  49.                 }
  50.  
  51.         }
  52.         else
  53.         {
  54.                 echo "User is not logged in.\n";
  55.         }
  56.     }
  57. }
  58. catch(ErrorException $e)
  59. {
  60.     echo $e->getMessage();
  61. }
  62. ?>

Mi primer problema es que no tengo esta referencia:
Código PHP:
require 'includes/lightopenid/openid.php'
Como instalo esta libreria?? (http://openid.net/developers/libraries/)
Supongo que lo debo tener delante de mis narices... pero no lo veo!!

Muchas gracias por su ayuda.
Salu2
__________________
Follow me on twitter @franbedia