This will grab all the data you request for the stocks you specified and display it all in a table. Then the table will be appended to a file called stocks.html. Play around with it/change whatever you need.
<?php
$quotes = array('msft', 'amzn', 'macr', 'rhat', 'orcl', 'yhoo', 'penn', 'ibm', 'goog');
$args = implode('&s=', $quotes);
$file = fopen("http://finance.yahoo.com/d/quotes.csv?s=$args&f=sl1d1t1c1ohgv&e=.csv", "rb");
$data = array();
$table = '';
if ($file) {
while($stocks = fgetcsv($file)) {
$data[$stocks[0]] = $stocks;
}
fclose($file);
}
$table .= "<table border='1'>\n";
$table .= "<tr><th colspan='10'>".date('Y-m-d h:i:s A')."</th></tr>\n";
$table .= "<tr>\n";
foreach ($data as $sym => $info) {
$table .= "\t<th>$sym</th>\n";
foreach ($info as $item) {
$table .= "\t<td>$item</td>\n";
}
$table .= (end($data) == $info) ? "</tr>\n" : "</tr>\n<tr>\n";
}
$table .= "</table><br/>";
echo $table;
file_put_contents('stocks.html', $table, FILE_APPEND);
?>