I have a URL format for CSV files that looks like this
http://www.domain.com/pathofinfo/compression/zip/
This allows an auto download of a zipped CSV file from the URL - however Parser CSV seems to be able to support this URL format?
Would it be possible?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | mime-type.patch | 819 bytes | burgs |
Comments
Comment #1
alex_b commentedYes. Requires some coding.
We would have to be able to detect the format of the file other than by the suffix of the url. We could use PECL's fileinfo http://www.php.net/manual/en/ref.fileinfo.php or just try to do an unzip on the file and see whether we're successful. If we can't unzip, we assume a text file.
I prefer the latter approach because it does not require PECL.
Comment #2
jpetso commentedmime_content_type() is deprecated but always available (even without the fileinfo extension) so if it's enclosed in a function_exists('mime_content_type') it should be perfectly fine to use it in order to determine the mimetype.
Comment #3
parrottvision commentedthanks alex_b - happy to try and pull some money together to sponsor it if it can be added?
Comment #4
alex_b commented#2 - I'm fine with function_exists('mime_content_type')
#3 - not money, but labor is scarce... : ) Could you get a developer on this? It's a small task.
Comment #5
parrottvision commentedburgs would you be up for it?
Comment #6
burgs commentedOk. want to try this?
Comment #7
alex_b commented#6: Is there any disadvantage in calling mime_content_type() on a remote file? Shouldn't we first download and then check for content type?
Comment #8
parrottvision commentedWould gzip work with this also?