John Russo
John Russo

Reputation: 1

Steam web api to get game data. PHP & JSON

I am looking for a steam web API to get info about games. Im trying to use this: $api_url_rust = "http://steamspy.com/api.php?request=appdetails&appid=252490";

$json2 = json_decode(file_get_contents($api_url_rust), true);

But I keep getting an error: Failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP

I don't think it has something with the way I have PHP installed. I tried running it on my schools server and I still gives me an error. Any idea how I can fix this or another API I could use? I also have other steam web API's that work fine.

Heres an example of one this is working correctly: $api_url_playerData = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$api_key&steamids=$steamid";

$json = json_decode(file_get_contents($api_url_playerData), true);

echo "Account Name: ". $json["response"]["players"][0]["personaname"] . "-----";

Upvotes: 0

Views: 876

Answers (1)

BendaThierry.com
BendaThierry.com

Reputation: 2109

So you want to consume a JSON response from an API served over SSL wihtout checking the SSL certificate. It is unsafe and not recommended.

File wrappers (in php especially) are not always enough to connect to another external webservice|microservice. You need to configure your php client to handle SSL properly OR you can do what you need safely only with building a SSL http client with php|java|python|go|etc., and load the JSON response.

It is exactly the same for any API, handshake properly with them and you can do what you need.

Upvotes: 0

Related Questions