I'm trying to download some files with PHP & CURL, but I don't see an easy way to use the default suggested filename (which is in the HTTP response header as
Content-Disposition: attachment; filename=foo.png
). Is there an easier way then get the full header, parse the file name and rename?
Best Answer
I initially tried to use php://memory instead of
/tmp/headers
, 'cause using temp files for this sort of thing is sloppy, but for some reason I couldn't get that working. But at least you get the idea...Alternately, you could use CURLOPT_HEADERFUNCTION