PDA

Click to See Complete Forum and Search --> : Autonomous IE


vb_lover
May 22nd, 2010, 02:14 PM
I would like to autonomously access a web page, parse the document and do what I need to do with the collected data. The IE window will be invisible to the user therefore I need to detect any errors associated with a bad URL or a inaccessable page, etc..

For example: If I navigate to the page and encounter a 404 error, then I would not parse.

HOW DO I ACCOMPLISH THIS?? I can't find a property that would hold such HTTP status codes in the IE object.


'example code:

Dim IE as New InternetExplorer
Dim Doc as New HTMLDocument


IE.Navigate "www.myURL.com", navNoReadFromCache

'i will start a timer here and IE.STOP if things take too long
timer1.interval = 30000
timer1.enabled = true

Do Until IE.ReadyState = READYSTATE_COMPLETE
if userStopFlag = true then
IE.STOP
exit sub
endif
Loop

timer1.enabled = false

'HERE IS WHERE I WANT TO EXAMINE TO SEE IF I REALLY
'HAVE SOMETHING TO PARSE, MAYBE THE URL IS BAD OR
'WHATEVER, I WANT TO KNOW IF THERE ARE ANY ERRORS
'BEFORE I PARSE. Such as 503, 404, etc....


'If we get here then we can begin document processing.

TCarter
May 28th, 2010, 12:17 PM
I believe WebBrowser1.DocumentText.Tostring holds the source code of the page.

Not 100% sure, but i know its one of those.

vb_lover
May 31st, 2010, 11:26 AM
I believe WebBrowser1.DocumentText.Tostring holds the source code of the page.

Not 100% sure, but i know its one of those.


Hi,
I was looking for a status code returned from the server, I didn't want to have to parse the document for error codes. I found that in some cases a status code is not visible in the document. I was hoping the server returned a numerical code other than imbedded in the document.