Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting html file into string via http
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00857149
Message ID:
00857187
Vues:
25
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform