Created
February 7, 2017 14:29
-
-
Save jtechera/5b76a6cfb935c3e64aafce113a2cab4a to your computer and use it in GitHub Desktop.
Get Dow Jones from Yahoo (not sure if it breaks TOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getDowJones() | |
{ | |
$rawData = file_get_contents("http://chartapi.finance.yahoo.com/instrument/1.0/%5Edji/chartdata;type=quote;range=1d/csv/"); | |
$data = explode("\n", trim($rawData)); | |
$csvData = $data[count($data)-1]; | |
$arrayDJI = explode(",", $csvData); | |
return number_format((float)$arrayDJI[4], 2, ',', ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment