📄 lookup.php
字号:
<html>
<head>
<title>Stock Quote from NASDAQ</title>
</head>
<body>
<?php
// choose stock to look at
$symbol='AMZN';
echo "<h1>Stock Quote for $symbol</h1>";
$theurl="http://www.amex.com/equities/listCmp/EqLCDetQuote.jsp?Product_Symbol=$symbol";
if (!($contents = file_get_contents($theurl)))
{
echo 'Could not open URL';
exit;
}
// find the part of the page we want and output it
$pattern = '(\\$[0-9 ]+\\.[0-9]+)';
if (eregi($pattern, $contents, $quote))
{
echo "<p>$symbol was last sold at: ";
echo $quote[1];
echo '</p>';
}
else
{
echo '<p>No quote available</p>';
};
// acknowledge source
echo '<p>'
.'This information retrieved from <br />'
."<a href=\"$theurl\">$theurl</a><br />"
.'on '.(date('l jS F Y g:i a T')).'</p>';
?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -