HTML Information Loading Issue

Posts 1–12 of 12 · Page 1 of 1
HTML Information Loading Issue
Hi i want to create a App that finds some Informations from a HTML code as Label.


Example:

LoadEvent:

Webbrowser1.Navigate("www.website.com/User=" & Textbox1.Text)

This will Load the UserInformation Place where Posts etc is written.

Now i want that it Laods some Informations Like:

Button1:

Label1.Text = Webbrowser1.Document.GetElementById.("HTML-Code-Name").Inner Text

That should draw the informatio from a html id of the user as label1.

But it is not working. Anyone knows how to do that cuz i am not very good in HTML.

Thanks
I don't understand...

Do you wanna display the HTML code of a page?
Either use RegEx or a StringBetween function.

Save the sourcecode of the page in a variable and extract the data you want to extract.
Quote Originally Posted by Sydney View Post
So i want my application to fish the as example Posts of the User Informations Bar.

Like:

Load:
webbrowser1.navigate("www.website.com/user=kongamonga")

button1
Label1.Text = Post of the user from the html code of the site.

That what i want, that it gets the as example posts or like activity.
Quote Originally Posted by Blubb1337 View Post
Either use RegEx or a StringBetween function.

Save the sourcecode of the page in a variable and extract the data you want to extract.
..........................
Quote Originally Posted by Blubb1337 View Post
..........................
more informations plz
So i want my application to fish the as example Posts of the User Informations Bar.

Like:

Load:
webbrowser1.navigate("www.website.com/user=kongamonga")

button1
Label1.Text = Post of the user from the html code of the site.

That what i want, that it gets the as example posts or like activity.
User regex to grab that information from the page's source like Blubb said!
[php]Public Function Sb(ByVal text As String, ByVal startstring As String, ByVal endstring As String) 'string between
Dim part1() As String = Split(text, startstring)

If UBound(part1) > 0 Then
Dim part2() As String = Split(part1(1), endstring)

If UBound(part2) > 0 Then
Return part2(0)
Else
Return -2
End If
Else
Return -1
End If
End Function
[/php]
Quote Originally Posted by Blubb1337 View Post
[php]Public Function Sb(ByVal text As String, ByVal startstring As String, ByVal endstring As String) 'string between
Dim part1() As String = Split(text, startstring)

If UBound(part1) > 0 Then
Dim part2() As String = Split(part1(1), endstring)

If UBound(part2) > 0 Then
Return part2(0)
Else
Return -2
End If
Else
Return -1
End If
End Function
[/php]
Are you completely ignoring me?

msgbox(SB(pagesource, "<bla>","</bla>"))
Use a HttpWebRequest or a WebClient to download the HTML source into a string variable.

[php]
Private Function GetSauce(ByVal URL As String) As String
Dim pageSauce as string = String.Empty
Using wClient As New Net.WebClient With {.Encoding = System.Text.Encoding.UTF8}
pageSauce = wClient.DownloadString(URL)
End Using
Return pageSauce
End Function
[/php]

Or

[php]
Private Function GetSauce(ByVal URL As String) As String
Using sRead As New IO.StreamReader(CType(Net.WebRequest.Create(URL), Net.HttpWebRequest).GetResponse.GetResponseStream)
Return sRead.ReadToEnd
End Using
End Function
[/php]

The above is actually ugly as fuck so here's a neater one:
[php]
Private Function GetSauce(ByVal URL As String) As String
Dim WebReq As Net.HttpWebRequest = Ctype(Net.WebRequest.Create(URL), Net.HttpWebRequest)
Dim WebResp As Net.HttpWebResponse = Ctype(webReq.GetResponse, Net.HttpWebResponse)
Using sRead As New IO.StreamReader(WebResp.GetResponseStream)
Return sRead.ReadToEnd
End Using
End Function
[/php]

Now you just assign the value that is returned by "GetSauce("http://www,website.com/User=" & TextBox1.Text)" To a variable, then use string manipulation to get the values you need.
Quote Originally Posted by Jason View Post
Use a HttpWebRequest or a WebClient to download the HTML source into a string variable.

[php]
Private Function GetSauce(ByVal URL As String) As String
Dim pageSauce as string = String.Empty
Using wClient As New Net.WebClient With {.Encoding = System.Text.Encoding.UTF8}
pageSauce = wClient.DownloadString(URL)
End Using
Return pageSauce
End Function
[/php]

Or

[php]
Private Function GetSauce(ByVal URL As String) As String
Using sRead As New IO.StreamReader(CType(Net.WebRequest.Create(URL), Net.HttpWebRequest).GetResponse.GetResponseStream)
Return sRead.ReadToEnd
End Using
End Function
[/php]

The above is actually ugly as fuck so here's a neater one:
[php]
Private Function GetSauce(ByVal URL As String) As String
Dim WebReq As Net.HttpWebRequest = Ctype(Net.WebRequest.Create(URL), Net.HttpWebRequest)
Dim WebResp As Net.HttpWebResponse = Ctype(webReq.GetResponse, Net.HttpWebResponse)
Using sRead As New IO.StreamReader(WebResp.GetResponseStream)
Return sRead.ReadToEnd
End Using
End Function
[/php]

Now you just assign the value that is returned by "GetSauce("http://www,website.com/User=" & TextBox1.Text)" To a variable, then use string manipulation to get the values you need.
Thanks for your work, but what if my element (name) has no value ?
Theres just the element ID and no name tag.
Well, you can PM me with the webpage in question and I'll try see whether the problem is that you don't have the correct ID's at the moment, if that's the problem none of our solutions will help you much as they'll likely rely on you putting in the elements ID at some point.
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us