Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting html file into string via http
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00857149
Message ID:
00857187
Views:
26
Try this code. Substitute ??? with valid Url, something like www.mysite.com/data.txt etc.
cFile = RemoteToLocal('http:???')
IF Not EMPTY(cFile)
	MODI FILE (cFile) NOWAIT
	* ? FileToStr(cFile)
ENDIF

FUNCTION RemoteToLocal(cRequest)
	DECLARE INTEGER URLDownloadToCacheFile IN urlmon;
		INTEGER lpUnkcaller, STRING szURL, STRING @szFileName,;
		INTEGER dwBufLength, INTEGER dwReserved, INTEGER pBSC

	LOCAL nResult, cTargetFile
	cTargetFile = Repli(Chr(0), 250)
	WAIT WINDOW NOWAIT "Downloading remote file..."

	nResult = URLDownloadToCacheFile(0, cRequest, @cTargetFile,;
		Len(cTargetFile), 0,0)

	WAIT CLEAR
	DOEVENTS
RETURN STRTRAN(cTargetFile, Chr(0), "")
The URLDownloadToCacheFile downloads remote data into the Internet cache and returns the local file name of the cache location.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform