找回密码
 加入
搜索
查看: 2613|回复: 4

[IE类操作] 要怎么读取网页指定内容,被正则弄昏了

  [复制链接]
发表于 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[0])
发表于 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[0])
EndIf
发表于 2011-6-9 09:35:01 | 显示全部楼层
水兄现身,迎刃而解!
 楼主| 发表于 2011-6-9 14:58:16 | 显示全部楼层
回复 2# 大绯狼


    好像有点懂了,只是需要区配纸白银那一行的正则对吧
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 05:43 , Processed in 0.095632 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表