switch ($p) { case 'login': include 'openid.php'; try { $openid = new LightOpenID('http://'.$_SERVER['SERVER_NAME'].'/'); if (!$openid->mode) { $openid->identity = 'http://steamcommunity.com/openid/?l=russian'; header('Location: ' . $openid->authUrl()); } elseif ($openid->mode == 'cancel') { echo ''; } else { if ($openid->validate()) { $id = $openid->identity; $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/"; preg_match($ptn, $id, $matches); $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=E7AE7AAE3CB43A2A642C855ACA4FE117&steamids=$matches[1]"; $json_object = file_get_contents($url); $json_decoded = json_decode($json_object); die($url); foreach ($json_decoded->response->players as $player) { $steamid = $player->steamid; $name = $player->personaname; $avatar = $player->avatarfull; } } } } catch (ErrorException $e) { exit($e->getMessage()); } break; default: header('location: /main'); exit(); break; } 

$json_object = file_get_contents($url); - gives an empty result.

Checked so, after the line $json_object = file_get_contents($url); put die($json_object) - the result is an empty page, $url is transmitted and displayed normally.

http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=E7AE7AAE3CB43A2A642C855ACA4FE117&steamids=76561198222889260 here is a valid $url .

How to get rid and find out what exactly the problem is? I'm suffering the second day

  • @ Jean-Claude f6.s.qip.ru/GjeazSvW.png die (var_dump ($ matches)); - stoner
  • In the plan did it in the script? To access the site, you need to log in to the platform. It's just that the point is that even if I match - I replace it with a specific steamid, the result will be the same - stoner
  • Well, look, you received $ id through the LightOpenID () class, it is probably for authorization, and you are trying to parse directly through file_get_contents, without authorization, look for whether there are parsing methods in this LightOpenID class. - Jean-Claude
  • @ Jean-Claude openid library is connected there gist.github.com/kiLLro/899b2e34375090ab8b1a4a0e5dc3d156 - stoner
  • about authorization to Jason was wrong, he goes through the key, curl works perfectly ideone.com/QYXv28 (the key cannot be lit by the way) - Jean-Claude

1 answer 1

In general, the code did not change anything. It turns out I did not have php-curl installed.

I executed the apt-get install php-curl command, rebooted the server and it all worked!