I have a project. I need to know how to access source HTML code of active HTML page.
I had tried with VB program its working this way :
Private Sub Command1_Click()
On Error GoTo command_error
With Label1
.Caption = ""
.AutoSize = True
.LinkTopic = "IExplore|WWW_GetWindowInfo"
.LinkItem = "0xffffffff"
.LinkMode = 2
.LinkRequest
End With
DoEvents
With Label2
.Caption = ""
.AutoSize = True
.LinkTopic = "Netscape|WWW_GetWindowInfo"
.LinkItem = "0xffffffff"
.LinkMode = 2
.LinkRequest
End With
st = Split(Label1, Chr(34) & ",")
'MsgBox (Replace(st(0), Chr(34), ""))
WebBrowser1.Navigate2 Replace(st(0), Chr(34), "")
Exit Sub
command_error:
'try the next step on error
Resume Next
End Sub
Private Sub GetHTMLSource(ByVal sURL As String)
txtSource = ""
sHost = Mid(sURL, InStr(sURL, "://") + 3)
If InStr(sHost, "/") > 0 Then
sPage = Mid(sHost, InStr(sHost, "/"))
sHost = Left(sHost, InStr(sHost, "/") - 1)
Else
sPage = "/"
End If
If InStr(sHost, ":") > 0 Then
lPort = Mid(sHost, InStr(sHost, ":") + 1)
sHost = Left(sHost, InStr(sHost, ":") - 1)
Else
lPort = 80
End If
With Winsock1
If .State <> sckClosed Then .Close
.RemoteHost = sHost
.RemotePort = lPort
.Connect
End With
End Sub
Private Sub Command2_Click()
Dim WebText As String
WebText = WebBrowser1.Document.documentElement.OuterHTML
MsgBox WebText
End Sub
Its working with google and other sites very nice. here i am taking live url and navigating with webbrowser control.
But My requirement is to fetch code from Ebay site. Once I url and displaying in webbrowser control its losing its session and going starintly to login window. so this is not good for my software.
Kindly give me any solution that can directly fetch source from Internet explorer so the session problem I can solve.
Thanks
Shibu Mathew