没有出错信息,提示:没有检索到信息。我怀疑出错的地方是:
1:
$theurl="http://quote.stockstar.com/stock/external_quote.aspcode=shag600728".$stock; 联接对方网页出错2:$pattern="(^[成交]+\\\$[0-9]+\\[0-9]+)";
这个正则表达式出错,但不知道怎样改。帮帮忙,看一看问题出在哪?
1:
$theurl="http://quote.stockstar.com/stock/external_quote.aspcode=shag600728".$stock; 联接对方网页出错2:$pattern="(^[成交]+\\\$[0-9]+\\[0-9]+)";
这个正则表达式出错,但不知道怎样改。帮帮忙,看一看问题出在哪?
...
<table border="0" cellspacing=0 width="100%">
<tr bgcolor="#F5F5F5">
<td nowrap> 成交</td>
<td align=right ><font color="red"> 7.78</font></td>
<td width=12><img src="images/spacer.gif" width=12 height=1></td>
<td align=right nowrap> 涨跌</td>
<td align=right > <font color="red">0.71</font></td>
</tr>
....假定保存于$text中,则
$text = preg_replace("/成交.+/","\\0",$text); // 提取从“成交”开始的数据
$text = strip_tags($text); // 删除html标记
preg_match_all("/(成交|涨跌)\s*([\d.-]+)/s",$text,$regs); // 提取数据
// 输出数据
foreach($regs[1] as $k=>$v)
echo "$v : {$regs[2][$k]}<br>";