fkeipkr 发表于 2011-6-9 06:18:28

要怎么读取网页指定内容,被正则弄昏了

需读取http://sj.zhijinwang.com/ag.asp里纸白银的价格数值 网页方面一些经验也没有还需要正则我晕晕

大绯狼 发表于 2011-6-9 09:21:17

$htmlstr=BinaryToString(InetRead("http://sj.zhijinwang.com/ag.asp",1))
$out=StringRegExp($htmlstr,'纸白银</a></font></td>\s*?<td[^>]+><font[^>]+>(.+?)</font></td>',3)
MsgBox(0,0,$out)

水木子 发表于 2011-6-9 09:22:47

#include <INet.au3>
$s_URL = 'http://sj.zhijinwang.com/ag.asp'
$sText = _INetGetSource($s_URL)
$sQuery = InputBox('查询数据', '输入你要查询的数据 - 如 纸白银', '纸白银')
If $sQuery Then
        $aSre = StringRegExp($sText, $sQuery & '.+?\r\n.+?#FF0000">([^<]+)', 3)
        If IsArray($aSre) Then MsgBox(0, '', $sQuery & ' 现价格 ' & $aSre)
EndIf

lhylm 发表于 2011-6-9 09:35:01

水兄现身,迎刃而解!
{:face (356):}

fkeipkr 发表于 2011-6-9 14:58:16

回复 2# 大绯狼


    好像有点懂了,只是需要区配纸白银那一行的正则对吧
页: [1]
查看完整版本: 要怎么读取网页指定内容,被正则弄昏了