title: Decoding the Yahoo Finance JSON Code
body: <p>So I found this URL to fetch data but I cant seem to access the JSON of what I need. Here is my code so far.</p>
  
  <pre><code>&lt;?php
  
  $url = "https://query1.finance.yahoo.com/v7/finance/options/AAPL";
  
  $result = file_get_contents($url);//allow_url_fopen  turned on in php. ini file
  
  
  // decode the json
  $resp = json_decode($result, true);
  
  
  print_r($resp['optionChain']['result']['expirationDates']);
  
  
  ?&gt;
  </code></pre>
  
  <p>I took the url and used a site to neatly format the code.
  <a href="https://jsonformatter.curiousconcept.com/" rel="nofollow noreferrer">https://jsonformatter.curiousconcept.com/</a></p>
  
  <p>But still no luck. Any suggestions? </p>
  
  <p><strong>P.S I have used the Google API code and Lottery API codes in JSON format in the past but I cant seem to get this one lol Weird huh</strong> </p>