Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing a Website in vfp8
Message
From
17/03/2004 16:36:58
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00887217
Message ID:
00887275
Views:
16
This code uses the Internet Explorer to retreive the page from a web site.
*--------------------------------------------
* open a session of IExporer 
*--------------------------------------------
LOCAL loIE, st
loIE=CREATEOBJECT('internetexplorer.application')

*--------------------------------------------
* Navigate to the web site.
*--------------------------------------------
loIE.Navigate( lcSomeURL )


*--------------------------------------------
*  wait until complete
*--------------------------------------------
DECLARE Sleep IN kernel32 INTEGER millisec
st =  SECONDS()
Sleep(50)
DO WHILE .T.
	DOEVENTS
	DO CASE
		CASE loIE.readyState=4 AND NOT loIE.busy
			EXIT
		CASE loIE.readyState=3 AND SECONDS()-st > 5
			EXIT
		CASE SECONDS()-st > 20				&& miximum time I will wait for this page.
			EXIT
	ENDCASE
	Sleep(50)
ENDDO


*--------------------------------------------
* get the resulting content of the page.
*--------------------------------------------
lcResult = oIE.DOCUMENT.body.outerhtml

*--------------------------------------------
* don't forget to clean up your mess.
*--------------------------------------------
RELEASE oIE, st
Hope this helps.
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform