Grabbing Information From A Webpage
Hello everybody! :wave:.
I am creating a project to aid playing an online game called runescape (not it is not anything against the rules), but I need help "grabbing" information from a webpage. One of the webpages on RS has all the world information, including how many people are on each world. I am wishing to get this information in VB and then display it in VB.
If anybody could give me any tips or point me in the right direction, it would be greatly appreciated.
Zeka
Re: Grabbing Information From A Webpage
There are some threads here that tackles such already, have a search. Here's one.
Re: Grabbing Information From A Webpage
Hello, zeka
Make sure you have Inet1 control on your form.
VB Code:
strURL = "http://www.runescape.com/aff/runescape/serverlist.cgi?plugin=0&hires.x=102&hires.y=32"
strHTML = Inet1.OpenURL(strURL, icString)
'get the number of players
strWorld1 = ParseHTML(strHTML)
'display number of players on World1
lblWorld1.caption = strWorld1
FUnction to parse the data from HTML
VB Code:
'World 1
Private Function ParseHTML(ByVal strHTML As String) As String
Dim strTemp As String
'Grab all of the string to the right of "class=c>World 1</a></td><td align=right>" >
strTemp = Mid(strHTML, InStr(strHTML, "World 1") + Len("World 1"))
'Delete everything to the left of the <td> tag along with the tag
strTemp = Mid(strTemp, InStr(strTemp, "<td align=right>") + 16)
'Get the field val
strTemp = Left(strTemp, InStr(strTemp, "</td>") - 1)
'return val
ParseHTML = strTemp
I also have code on how to grab player stats from the stat page if u need that too.
You can try and put this in an array to cycle through each world and the get the data.
PS- I'm starting a new client project for rs, email me if u wanna help out. ([email protected])
Re: Grabbing Information From A Webpage
Re: Grabbing Information From A Webpage
hey both of you, thanks! I have yet to try this but is sounds great. The code for grabbing the players stats would be greatly appreciated. Thanks again.
Re: Grabbing Information From A Webpage
ummm i cant even add the inet control, it says appropriate liscence information could not be found ummm... help? thanks guys
Re: Grabbing Information From A Webpage