Market Game Stock Prices
Posted: Mon Jul 11, 2011 10:10 am
Hi ;
Market game's in popular stocks somethink wrong for last 2 days
(( Quote Date ))
McDonalds Corp. MCD $85.6 7/8/2011 at 4:00pm
Today 11/8/2011 But quote date is don't change for last 4 day and cost is same..
Here is my Stok1.php
and Here is my index.php like connecting to finance.yahoo
Market game's in popular stocks somethink wrong for last 2 days
(( Quote Date ))
McDonalds Corp. MCD $85.6 7/8/2011 at 4:00pm
Today 11/8/2011 But quote date is don't change for last 4 day and cost is same..
Here is my Stok1.php
Code: Select all
<?php
include 'connect.php';
include 'index.php';
?>
<?php
echo "<div id='contentic' align='center'>";
if (isset($_POST['stocks']))
{
$bypass = 1;
$list = $_POST['list'];
$selectbackpack="SELECT * from stocks where list = '$list'";
$selectbackpack2=mysql_query($selectbackpack) or die("could not select backpack");
echo "<center><b>Popular Stocks</b><table border='1' bordercolor='black' bgcolor='#ffffff'>";
echo "<tr><td align='right'>Shares</td><td bgcolor='#99FFFF'>Name </td><td>Symbol </td><td bgcolor='#FFFFCC'>Value </td><td>Quote Date</td></tr>";
while($selectbackpack3=mysql_fetch_array($selectbackpack2))
{
$symbol = $selectbackpack3['Ssymbol'];
$arrayed = checkstocks($symbol);
$arrayed2 = split(",",$arrayed);
$quote = $arrayed2[0];
$date = $arrayed2[1];
$time = $arrayed2[2];
echo "<tr><td><form method='POST' action='index.php'>
<input type='submit' value='Buy' name='submit' />
<input type='hidden' name='buystocks' value='1'>
<input type='text' size='5' name='amount' />
<input type='hidden' name='symbol' value='$selectbackpack3[Ssymbol]'>
</form></td><td bgcolor='#99FFFF'>$selectbackpack3[name]</td><td>$selectbackpack3[Ssymbol]</td><td bgcolor='#FFFFCC'>$quote</td><td>$date at $time</td></tr>";
}
echo "</table>Yada stok kodunu giriniz.<form method='POST' action='index.php'>
<input type='text' size='10' name='name' />
<input type='submit' value='Check Stock' name='submit' />
<input type='hidden' name='checkstock' value='1'>
</form>";
echo "<small><br />http://finance.yahoo.com & Stok Kod Listesi</center></small>";
echo "<center><br><form method='POST' action='index.php'>
<input type='submit' value='Go Back' name='submit' />
<input type='hidden' name='stockmain' value='1'>
</form>";
}
///////////////////////////////////////////////////////////////////////////////////
?>
and Here is my index.php like connecting to finance.yahoo
Code: Select all
<?php
function checkstocks($symbol)
{
$url = 'http://finance.yahoo.com/d/quotes.csv'.'?s='.$symbol.'&e=.csv&f=sl1d1t1c10hgv';
if (!($contents = file_get_contents($url))) {
die("Url acilis hatasi ".$url);
}
list($symbol, $quote, $date, $time) = explode(',', $contents);
$date = trim($date, '"');
$time = trim($time, '"');
$quote = round($quote,2);
$arrayed = $quote . "," . $date . "," . $time;
return $arrayed;
}
$bypass = 0;