Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need the name of the file downloaded
Message
From
13/03/2017 13:47:21
 
 
To
13/03/2017 12:36:31
General information
Forum:
Visual FoxPro
Category:
Web Services
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01648981
Message ID:
01648985
Views:
95
This message has been marked as the solution to the initial question of the thread.
>Hi friends
>
>This is the point: The instructions below download a PDF file with information about a fiscal key (cCuit)
>
>oconstancia = Createobject("Shell.Application")
>oconstancia.Open("https://soa.afip.gob.ar/sr-padron/v1/constancia/"+STRTRAN(cCUIT,'-',''))
>
>Since the file is downloaded (and opened) in the default download fold I could research using environment variables and somehow I could get the data I desire: THE NAME OF THE FILE
>
>But there should be a better method I don't know without opening the file and that's why I'm here right now...
>
>The instruction below puts MY specified name, and that's not what I want.
>
>lnGetResults = URLDownloadToFile(0, lcGetURL, lcTempTxtFile, 0, 0)
>
>Does anyone know how I cant obtain the name of the file downloaded?
>
>Thank you.
>
> Héctor

If the name of the file is passed by the web service, then most probably it is coming downstream in the response header.
CLEAR

LOCAL SXMLHTTP AS MSXML2.ServerXMLHTTP60

m.SXMLHTTP = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")
m.SXMLHTTP.Open("GET", ""https://soa.afip.gob.ar/sr-padron/v1/constancia/" + STRTRAN(m.cCUIT, '-' ,''), .F.)
m.SXMLHTTP.Send()
? m.SXMLHTTP.Getresponseheader("Content-Disposition")
WAIT WINDOW "Press a key..."
?
? m.SXMLHTTP.Responsebody
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform