Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to read the source code of a URL?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00800414
Message ID:
00800421
Views:
24
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform