0

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.

<?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']);


?>

I took the url and used a site to neatly format the code. https://jsonformatter.curiousconcept.com/

But still no luck. Any suggestions?

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

Carlitos
  • 419
  • 4
  • 20

0 Answers0