Created
December 24, 2016 16:17
-
-
Save prahladyeri/f81121046a918ae7e999d38abc27379e to your computer and use it in GitHub Desktop.
This file contains 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 | |
//Fetching the latest value of BSE-Sensex in just 9 lines of PHP code: | |
$data = http_build_query(array("client"=>"ig", "q" => 'BSE:SENSEX')); | |
$url = "http://finance.google.com/finance/info?"; | |
$ch = curl_init(); | |
$curlConfig = array( CURLOPT_URL => $url.$data, CURLOPT_RETURNTRANSFER => true); | |
curl_setopt_array($ch, $curlConfig); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
$result = substr($result,3); | |
print_r( json_decode($result)[0]->l); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment