One of the solutions:
*-----------------------
PROCEDURE YR_GetHTMLSource
#DEFINE READYSTATE_COMPLETE 4
DECLARE INTEGER FindWindow ;
IN WIN32API ;
STRING cNULL, ;
STRING cWinName
DECLARE INTEGER FindWindow IN WIN32API ;
STRING lpclassname, STRING lpCaption
Declare Long SetActiveWindow in WIN32API Long hwnd
oShell = CreateObject("WScript.Shell")
IF type("oIe")#"O" OR ISNULL(oiE)
oIE = CreateObject("InternetExplorer.Application")
endif
oIE.Navigate("
http://www.microsoft.com")
oie.Visible=.t.
do while oIE.Readystate <> READYSTATE_COMPLETE
wait wind time 1.0 "Connecting to web site...."
enddo
lchtml=""
if oShell.AppActivate(oIE.Document.title)
oShell.SendKeys("%Vc") &&get source html to notepad
WAIT WINDOW TIMEOUT 2.0 ""
lhWnd = FindWindow("Notepad", 0)
if lhWnd#0 AND SetActiveWindow(lhWnd)=0
??"Activated"
oShell.SendKeys("^+{END}^C") &© to clipboard from notepad
lchtml=_cliptext
WAIT WINDOW TIMEOUT 2.0 ""
oShell.SendKeys("%Fx") &&close notepad
endif
else
* whatever
ENDIF
=STRTOFILE(_cliptext,"c:\txt.txt")
oIE.Quit
oie=.null.
oShell=.null.
CLEAR DLLS
*-----------------------
See also message #
778857>I have a URL and I want to access the source code from within my VFP 6.0 application. It that possible and how would it be done?
>
>My client inputs a Parcelid number. Given the number I know how to build the URL to access the property appraisers web site. I then want to read the source file and pull off peices of data to update my table.
>
>Thanks
>
>Brenda