function getYahooQuote($stockSymbol = "CCR")
{
if (!$targetURL) $targetURL = "http://finance.yahoo.com/q?s=$stockSymbol&d=t "; //設定要提取的URL目標
$fd = fopen("$targetURL", "r");
= 0;
while ( !feof($fd))
{
$ //迴聲修剪($buffer)."n";
if (strstr($buffer , "rowspan=3"))
{
$startExtract = 1;
} $stopExtract)
{
if (strstr($buffer, " {
$startPos = strrpos($buffer, " $ buffer = substr($buffer, $startPos);
}
//迴聲修剪($buffer)."n";
$buffer = str_replace("nr", " ", "$buffer");
s=$stockSymbol" ))
{
";
$stopExtract = 1;
}
$capturedHTML .= $buffer;
}
if ($startExtract && strstr($buffer, "
") )
{
$stopExtract = 1;
//echo "提取在#$lineCountn行停止";
echo $capturedHTML;
休息;
}
$lineCount ;
}
fclose($fd);
}
//以下為抓取的例子
$symbols = array('CCR', 'IIXL','SAPE','WBVN' );
);
for ($i=0; $i {
ymbols[ $i]");
}
?>