-4

I just wanna ask one question, how can i define the "0" ? code : https://paste.laravel.io/gQYKN#19

<?php

$apiKey = 'api';
$steamId = 1337;
$apiUrl = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $apiKey . '&steamids=' . $steamId;

$json = json_decode(file_get_contents($apiUrl), true);
$join_date = date("D, M j, Y", $json["response"]["players"][0]["timecreated"]);

function personalState ($state) {
    $states = [
        1 => 'Online',
        2 => 'Busy',
        3 => 'Away',
        4 => 'Snooze',
        5 => 'Looking for trade',
        6 => 'Looking to play'    
    ];

    if (!empty($states[$state])) {
        return $states[$state];
    }

    return 'Offline';
}
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
gobby
  • 13
  • 5

1 Answers1

0

I have extensive experience with the Steam API; you either have an invalid API key, or you are supplying an incorrect SteamID. Theres no definitive way to tell which unless you show the output of print_r($json);.

Ensure the SteamID is of the following format: 7656xxxxxxxxxxxxx (where x's are all digits, SteamID64's are all 17 digits long), and that you have the correct API key found here: http://steamcommunity.com/dev/apikey

Enstage
  • 2,106
  • 13
  • 20
  • hmm, API key is correct and steam id 64 same. But now i have only blank page ? what can be wrong ? code - https://paste.laravel.io/on9qW – gobby May 11 '17 at 11:32
  • If you getting a blank page when visiting your site, thats good, because theres no errors. You're not echoing anything, so you shouldn't expect any output. – Enstage May 11 '17 at 12:38