Answer the question
In order to leave comments, you need to log in
How to get data from JSON string?
<?php
$url = file_get_contents('https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH,BCH&tsyms=BTC,USD&api_key=MY-API-KEY');
$json = json_decode($url, true);
var_dump($json);
echo $json[0];
?>
Answer the question
In order to leave comments, you need to log in
Well $json[0]
, it doesn't work, because you don't have a 0 index,
but what are the problems with data access?
<?php
$url = file_get_contents('https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH,BCH&tsyms=BTC,USD&api_key=MY-API-KEY');
$json = json_decode($url, true);
echo 'Eth to usd: ' . $json['ETH']['USD'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question