Page 1 of 1

Following redirect to a second URL

Posted: Sun Apr 22, 2007 8:25 pm
by jakejarvis
Hi all,

I'm developing a site relating to YouTube videos. I currently have a function that retrieves the YouTube FLV URL. For example:

http://www.youtube.com/get_video?video_ ... 9Ia-RxuCoh

However, this URL redirects to another URL that is the true location of the video file. For example, the above URL redirects to:

http://lax-v158.lax.youtube.com/get_vid ... C71t8GzqPs

My Flash applet does not work if the function returns the non-redirected URL. Is there any way to make a function that follows the first URL and returns the true location of the video file (the second URL)?

Thanks in advance for any help.

Posted: Sun Apr 22, 2007 10:32 pm
by jwalsh
A few notes... The redirected location is not going to be the "true" location of the file, it's routing you through a server to control the server loads. View the same video 3 or 4 times and you may get 3 or 4 different redirected paths. So, the URL you should bookmark is the one that YouTube gives to you in the first place.

Also, this is a PHP forum, so for a better response to your flash related question, you may want to try a flash forum.