visual studio 2010 - VB.NET - How do I search through Webpage source for particular div and output inside txt as msgbox? -
vb.net - how search through webpage source particular div , output inside txt msgbox?
so far can download webpage's source code. don't know how search through particular string of information.
code far:
dim source string = new system.net.webclient().downloadstring("http://pagewantingtouse.com")
the division called "description", i'm after information within it. want output message-box.
example below:
<div class="description"> amazing spider-man 2012 american superhero film based on marvel comics character spider-man. fourth installment of spider-man film series, serving reboot. </div>
i had laying around project did. takes page , stream reads web browser, , pulls out whatever want it. looked @ reading string before, problem me, @ least, had find length between tags, etc. worked me:
dim request webrequest = webrequest.create("http://pagewantingtouse.com") 'create web request html file using response webresponse = request.getresponse() 'get response request using reader new streamreader(response.getresponsestream) 'identify how want read response , assign streamreader dim webtext string = reader.readtoend() 'read response (web page) string end of file dim wbc webbrowser = new webbrowser() 'create web browser handle data. sift through wbc.documenttext = "" wbc.document .opennew(true) .write(webtext) 'write web page response web browser control dim itemlist htmlelementcollection = .getelementsbytagname("div") each item in itemlist 'look @ each item in collection if item.classname = "description" msgbox item.innertext 'this msgbox description exit 'exit once found end if next 'do every item in collection until find end wbc.dispose() end using end using
if want tell me page, can update code, should @ least answer question.
Comments
Post a Comment