Avi Thour Avi Thour -4 years ago 51
HTML Question

Error in storing data through API

I want to call the data from API to store in my variable.
My Code:

<?php $url = "https://api.steampowered.com/ICSGOServers_730/GetGameMapsPlaytime/v1/?format=json&key=E5F331493A95AA54FD1230551754AB19&mapgroup=operation&gamemode=casual&interval=month";

$mapinfo = json_decode(file_get_contents($url), true);
$b = $mapinfo['result'];

<!DOCTYPE html>
<title>Operation Maps Stats</title>

<?php echo "$b"; ?>

Notice: Array to string conversion in D:\xampp\htdocs\operation\index.php on line 14

Answer Source

Write print_r($b); instead of echo "$b" on line 14 because result is array.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download