• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Stock market Status

Admin

Well-Known Member
Staff member
Administrator
Create New Widget for PHP direct Execution It shows stock market status

copy and paste the following code and place

just change the array symbol as per your requirement. $Arraysymbol = array("NSE:NIFTY", "NSE:CNXMIDCAP", "NSE:CNX500","NSE:CNX100");

PHP:
$Arraysymbol = array("NSE:NIFTY", "NSE:CNXMIDCAP", "NSE:CNX500","NSE:CNX100");
//Obtain Quote Info - This collects the Microsoft Stock Info
$output .="<style>
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
table,th,td
{
border:1px solid black;
}
</style>";
 $output .= "<table><thead><tr>
      <th>Index</th>
      <th>Current</th>
	  <th>change</th>
	  <th>Percent</th>
    </tr>
  </thead>
 <tbody>";
 foreach ($Arraysymbol as $i => $value) {
  
 $quote = file_get_contents('http://www.google.com/finance/info?infotype=infoquoteall&q='. $Arraysymbol[$i]);
   //Remove CR's from ouput - make it one line
  $json = str_replace("\n", "", $quote);
  
  //Remove //, [ and ] to build qualified string  
  $data = substr($json, 4, strlen($json) -5);
    //decode JSON data
  $json_output = json_decode($data, true);
   $output .= "<tr><td>". $json_output['name']. "</td><td>".  $json_output['l'] . "</td><td>".  $json_output['c'] . "</td><td>".  $json_output['cp'] . "</td></tr>";
  
}
 $output .= "  </tbody>
</table>";

you are done.
 

Facebook Comments

New posts New threads New resources

Back
Top