Link to home
Start Free TrialLog in
Avatar of Reggie_BE
Reggie_BE

asked on

fetch source code from site

Hi,

Is there a way to read the sourcecode of a site using the Internet Control Webbrowser ?
I would do it with just the raw sock, but I have to login to see that page. And I have no idea how I can save the session or cookies. So I'm trying it just with the internet control.

I have to read some info from the members area, that's why I need to get the sourcecode via that control. Anyone knows how ?
ASKER CERTIFIED SOLUTION
Avatar of ericl1st
ericl1st

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ericl1st
ericl1st

Sorry, I mistyped the "To get everything between the body tags, without the body tags". It should read:

WebBrowser1.Document.body.innerhtml

Cheers!
Avatar of Reggie_BE

ASKER

Do I have to do something special before those lines ?
I tried

WEB.Navigate "http://wwww.reggie.be"
MsgBox WEB.Document.documentElement.outerhtml

but it gives an error: Object Variable or With Block variable not set.
I'm using VB 6.0
The problem is that you can't have the "WEB.Navigate" command and the second command right after each other because the page can't load that quickly. Either put the code "MsgBox WEB.Document.documentElement.outerhtml" in a command button and click it after the page loads, or in either the "WEB_DocumentComplete" event (to show the message box after the page is displayed) or "WEB_NavigateComplete2" event (to show the message box after the page loads but before it is displayed).

Cheers!