I have code:
$json = file_get_contents('https://api.coinmarketcap.com/v1/ticker/?limit=0');
$coins = json_decode($json, true);
foreach($coins as $coin) {
echo $coin->24h_volume_usd;
}
Script return me error:
Parse error: syntax error, unexpected '24' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'...
Yes, I know I can't used name JSON with number, but I can't change 24h_volume_usd to for example: h_volume_usd, because this is value download from other page (ink).
json_decode(), but that part is missing from your code.echo $coin['24h_volume_usd'];I have error: Cannot use object of type stdClass as array