libURLDownloadToFile and cgi links
Posted: Fri Aug 09, 2013 5:17 pm
I've been doing some web scraping of a page for downloading of listed files, but I'm encountering some difficulty with libURLDownloadToFile when the link doesn't contain the actual filename, such as when it's some sort of cgi script that then returns the actual file.
When the filename is in the url, I can extract it and pass it to libURLDownloadToFile. When it is not, I have no idea what the filename should be, and can only make a temporary filename.
When the same link is clicked in a browser however, the Save Download dialog that opens shows the correct name of the file. What I need to do is the same thing, either internally to libURLDownloadToFile so that it names the file automatically (and giving it a directory instead of a filename does not do this) or get the filename from the url by some other means first so that it can be passed to libURLDownloadToFile.
Anyone know how this can be done?
When the filename is in the url, I can extract it and pass it to libURLDownloadToFile. When it is not, I have no idea what the filename should be, and can only make a temporary filename.
When the same link is clicked in a browser however, the Save Download dialog that opens shows the correct name of the file. What I need to do is the same thing, either internally to libURLDownloadToFile so that it names the file automatically (and giving it a directory instead of a filename does not do this) or get the filename from the url by some other means first so that it can be passed to libURLDownloadToFile.
Anyone know how this can be done?