ameliabob Posted June 24, 2018 Share Posted June 24, 2018 I am trying to get a url that returns a json file but nothing seems to work nor do I get any errors <html> <body> <h1>Trial of getting url</h1> <?php echo "Hello World!"; $url = "https://api.iextrading.com/1.0/stock/market/batch?types=quote&filter=symbol,companyName,latestPrice,latestSource&symbols=AMD,APVO,DHI,ERI,GERN,LUV,LX,NVCR,TAP,WAR"; $url="https://www.espn.com"; $ans = fopen($url, "r"); ?> </body> </html> It should return the following: AMD quote symbol "AMD" companyName "Advanced Micro Devices Inc." latestPrice 15.8 latestSource "Close" APVO quote symbol "APVO" companyName "Aptevo Therapeutics Inc." latestPrice 5.54 latestSource "Close" DHI quote symbol "DHI" companyName "D.R. Horton Inc." latestPrice 40.75 latestSource "Close" ERI quote symbol "ERI" companyName "Eldorado Resorts Inc." latestPrice 44.25 latestSource "Close" Link to comment Share on other sites More sharing options...
justsomeguy Posted June 25, 2018 Share Posted June 25, 2018 That's not what www.espn.com returns, it returns a complete web page. You're also not doing anything with the actual contents of the file, you open it but don't read anything. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now