Working with Steam API, I'm stuck with the following problem: when trying to get player achievements, it's perfect - when it's returing results, something like this:
{
"playerstats":{
"steamID":"xxxxxxxxxxxxxxxxx",
"gameName":"Life is Strange™",
"achievements":[
{
"apiname":"AC_1",
"achieved":1,
"unlocktime":1620689085
},
{
"apiname":"AC_2",
"achieved":1,
"unlocktime":1620677605
},
/* ETC, ETC... */
{
"apiname":"AC_60",
"achieved":0,
"unlocktime":0
}
],
"success":true
}
}
But in some cases, a product can return empty, because it doesn't have achievements, like this:
{
"playerstats":{
"error":"Requested app has no stats",
"success":false
}
}
And then I get an error Bad Request 400 for the file_get_contents.
My code is:
$json_achv = file_get_contents('https://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid='. $the_appid .'&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&steamid='. $steam_userid);
$data_jprog = json_decode($json_achv,true);
I have tried this, same result (Bad Request 400). And using curl, the json_decode returns NULL.
Any thoughts?