I'm trying to download and save files like this (http://www.example.com/bajar.php?id=420633&u=7) but keeping the original filename.
I've already searched and found this code:
file_put_contents('test.rar', file_get_contents('http://www.example.com/bajar.php?id=420633&u=7');
But in this case I have to put the filename 'test.rar' manually, how can I do the same obtaining the original filename?
Many thanks!