Damein Posted May 12, 2012 Share Posted May 12, 2012 So I wanted to pull the data in a new post on a forum. I think this should be rather easy. This was my attempt $Url = 'http://s15.zetaboards.com/Sniper_League/topic/7193078' Global $sSource = BinaryToString(InetRead($Url)) For $i = 1 To 1000 Step +1 $PostCount = StringRegExp($sSource,'(?i)(?s)Post \#(.*?)</a>',1) MsgBox(0, "Test", $PostCount[0]) If @Error Then $Count = $i ExitLoop EndIf Next MsgBox(0, "Test", $Count) Exit While 1 Sleep(10) WEnd So the posts are labeled with numbers, so I was going to do a StringReg, see how many it counts to and then when it errors out I know that it has found the last post. But my thing returns an error because it didn't find a match. The content is: Post #2</a> So the stringreg I thought would pull a "1" and then a "2" and stop. But it didn't. Not sure what I did wrong, I've always been fail at StringReg. I'm also quite tired. So I'm heading off to bed, if I don't think of something I'll check back in Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Damein Posted May 12, 2012 Author Share Posted May 12, 2012 (edited) Resolved by the following code: $Url = 'http://s15.zetaboards.com/Sniper_League/topic/7193078' Global $sSource = BinaryToString(InetRead($Url)) For $i = 1 To 1000 Step +1 $PostCount = StringRegExp($sSource, '(?i)(?s)Post #' & $i & '(.*?)<tr class="c_postfoot">', 1) $PostData = StringRegExp($PostCount[0], '(?i)(?s)<td class="c_post">(.*?)</td>', 1) $NewPostData = StringStripWS($PostData[0],3) MsgBox(0, "Test", $i & $NewPostData) If @Error Then $Count = $i ExitLoop EndIf Next MsgBox(0, "Test", $Count) Exit While 1 Sleep(10) WEnd Edited May 12, 2012 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now