I want to download a remote file and put it in my server directory with the same name the original has. I tried to use file_get_contents($url).
Problem is that the filename isn't included in $url, it is like: www.domain.com?download=1726. This URL give me, e.g.: myfile.exe, so I want to use file_put_contents('mydir/myfile.exe');.
How could I retrieve the filename? I tried get_headers() before downloading, but I only have file size, modification date and other information, the filename is missing.