Page 1 of 1

Tracing redirect URL

Posted: Wed Aug 09, 2006 4:58 pm
by vytis
Hi,

I did a lot of googling on this subject, but still no luck and I'm now begining to lose hope.
I am trying to implement a function where a user can paste a link (URL) to a file he/she wants to download and the script outputs the file name, type and size (this is just a small bit of my larger project). Very often links are not direct and redirected through php scripts. Such as this mp3 on my own band's website running a CMS:

http://www.soyamodified.com/download.ph ... 91617,22,1

When you click on it in the browser, it lets you download the file as "Soya Modified - 05 Tune Up Your Life (demo).mp3" - is there a way of "converting" that URL into this filename through PHP?

Thank you very much and hopefully I've explained my problem clearly enough.

ANY ideas appreciated!

Posted: Wed Aug 09, 2006 6:40 pm
by RobertGonzalez
Is this supposed to be done blindly or by selecting from a list?

Posted: Thu Aug 10, 2006 2:46 am
by vytis
Users will paste any URL they like (not from a list), which the script will then try to download to the server.
The problem is that often they might paste non-direct URLs (redirection links) because on a browser they point to the actual file anyway.

Is there a way to simulate browser-style handling of URLs (such as used by download managers - where even if you type a redirect URL, it will download the actual file, not the HTML that contains redirection code?

Many thanks!

Posted: Thu Aug 10, 2006 8:10 am
by feyd
cURL is your new friend. Image