|
-
May 12th, 2009, 11:15 AM
#1
Thread Starter
Hyperactive Member
Getting Source of Web Page [Impossible?]
I need to get the source of a webpage that my browser control has loaded.
Whenever i use browser.document.htmltext or anything like that dont get the proper source that i need.
The URL is masked so i can't use some sort of HTTP response request to get the page source.
The website only works with IE and does not behave normally like most sites.
The only way I've been able to get the source that i need is right clicking the webpage in my browser, and selecting "View Source".
How can i do this "View Source" programmicatally so i can work with the source code of the web page?
Thanks,
Philly0494
-
May 12th, 2009, 12:35 PM
#2
Re: Getting Source of Web Page [Impossible?]
What you need is the DocumentText property of the WB object.
Code:
Dim htmlSource As String = browser.DocumentText
Note that if the page uses frames, you will only get the source of 1 frame.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
May 12th, 2009, 01:00 PM
#3
Thread Starter
Hyperactive Member
Re: Getting Source of Web Page [Impossible?]
i guess i wasn't clear, the webpage is in frames and .DocumentText does not supply the source code that I need
i have tried almost everything but I am still unable to retrieve the source of this web page.
The URL is static regardless of where you navigate to on this website.
-
May 12th, 2009, 01:22 PM
#4
Re: Getting Source of Web Page [Impossible?]
I'm not sure, but the following code should work.
vb.net Code:
Dim wc As New System.Net.WebClient() TextBox1.Text = wc.DownloadString("http://google.com")
If it doesn't work, what website's html are you trying to obtain?
*Edit- This won't apply. I didn't read the post entirely :P Sorry
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
May 13th, 2009, 09:24 AM
#5
Thread Starter
Hyperactive Member
Re: Getting Source of Web Page [Impossible?]
yeah that won't work cause the URL i static throughout navigation of the site
so is there any way to do this?
-
May 13th, 2009, 10:06 AM
#6
Re: Getting Source of Web Page [Impossible?]
Why don't you give us the url of that web page so that we can try to work it out?
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
May 13th, 2009, 10:38 AM
#7
Thread Starter
Hyperactive Member
Re: Getting Source of Web Page [Impossible?]
 Originally Posted by stanav
Why don't you give us the url of that web page so that we can try to work it out?
the URL is: https://navinet.navimedix.com/Main.asp
but you have to login to navigate to the page that I need, but the URL remains the same even after you login and navigate through the site
-
May 13th, 2009, 12:36 PM
#8
Member
Re: Getting Source of Web Page [Impossible?]
I do a rather insane amount of work with the WebBrowser control. This should work for you:
vb Code:
MsgBox(Me.WebBrowser1.Document.Window.Frames(6).Frames(1).Document.All(1).OuterHtml)
Note that in that example I am accessing a frame nested inside of another set of frames. Once you know where the frame is located, that is how you access it's source.
Hope it helps.
In case I forget: I'm using Visual Basic 2008 Express Edition...
Should I, in my odd, bumbling way, actually offer some assistance, feel free to show me some RATE love.
Just Another Laptop Hero
-
May 13th, 2009, 08:25 PM
#9
Re: Getting Source of Web Page [Impossible?]
Based on that, I'd say...
vb Code:
Public Function GetHTML(ByVal page As HTMLDOCTYPE) As String()
Dim totalsource As New List(Of String)
totalsource.Add(page.DocumentText)
If page.Frames.Count > 0 Then
Dim i As Integer = 0
While i < page.Frames.Count
totalsource.AddRange(GetHTML(page.Frames(i)))
i += 1
End While
End If
Return totalsource.ToArray()
End Function
You'll have to iron it out, it's semi-hemi-demi-psuedocode.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|