Today I was asked for help with a FoxPro issue, about how to download a file via HTTP.
I found two things: one was a paid ActiveX, and the other one requires libcurl.
Is there a way to do that without anything additional (VFP 8), something like HttpURLConnection
in Java? For example by using Microsoft.XMLHTTP
Two snippets that work, and require no additional files/dlls/flls/etc.
Local loRequest, lcUrl, lcFilename
lcUrl = "http://example.com/foo.zip"
lcFilename = "C:\Temp\PSV.zip"
loRequest = Createobject('MsXml2.XmlHttp')
loRequest.Open("GET",lcUrl,.F.)
loRequest.Send()
StrToFile(loRequest.ResponseBody,lcFilename)
and
lox = CREATEOBJECT("inetctls.inet")
lcSuff = lox.OpenURL("http://whatever.co.uk/suff.htm")
STRTOFILE(lcStuff, "c:\data\myfile.htm")
(taken from here)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With