title: How to use PHP to fetch and decode JSON data?
body: <p>How can I get variables "price_usd" and "price_btc" from JSON url <a href="https://api.coinmarketcap.com/v1/ticker/ethereum/" rel="nofollow noreferrer">https://api.coinmarketcap.com/v1/ticker/ethereum/</a>? I wrote a script but nothing happens. </p>
  
  <pre><code> &lt;?php
  $tick = file_get_contents('https://api.coinmarketcap.com/v1/ticker/ethereum/'); 
  $url = $tick;
  $json = file_get_contents($url);
  $data = json_decode($json, TRUE);
  
  $usd = $data[0]["price_usd"];
  echo $usd;
  ?&gt;
  </code></pre>