留言板留言读取[已解决]
本帖最后由 lanfengc 于 2010-4-9 16:08 编辑#include <INet.au3>
$File=InetGet("http://58.ieeie.com/58/book.aspx?username=lanfenglovec",@TempDir&"\temp.htm",1,0)
$Code=FileRead(@TempDir&"\temp.htm" )
$Code=StringSplit($Code,"查看留言",1)
$Code=StringSplit($Code,"首页",1)
$Code=StringSplit($Code,"STYLE33",1)
MsgBox(0,"总留言条数为",$Code)
For $i=2 To $Code Step 1
$Fir=StringSplit($Code[$i],'STYLE29"'&'>',1)
$1=StringSplit($Fir,"</sp",1)
$1=StringTrimLeft($1,5)
$2=StringSplit($Fir,"</sp",1)
$2=StringTrimLeft($2,5)
MsgBox(0,$1,"留言内容:"&$2)
Next
InetGet("http://58.ieeie.com/58/book.aspx?username=lanfenglovec", @TempDir & "\temp.htm", 1, 0)
$Code = FileRead(@TempDir & "\temp.htm")
$ID = StringRegExp($Code, '网友留言:([^<]+)</', 3)
If @error Then Exit MsgBox(0, 0, '错误1')
$str = StringRegExp($Code, 'STYLE29\">\s+([^<]+)\r\n</span><', 3)
If @error Then Exit MsgBox(0, 0, '错误2')
Dim $out = ''
For $i = 0 To UBound($ID) - 1
$out &= 'ID:' & @CRLF & $ID[$i] & @CRLF & '内容:' & @CRLF & $str[$i] & @CRLF & @CRLF
Next
MsgBox(0, '共 ' & UBound($ID) & ' 条留言', $out) 回复 2# afan
AFAN 正则厉害顶一个。
页:
[1]