Guys, I have a question about whether something can be done or not, and if so, how:

Basically, I have been converting standard YouTube URLs in to a URL that will provide an .MP4 file. It's quite simple, as this blog post explains. Here is the JavaScript that this uses:

Code JavaScript:

I have done some more work with this in PHP and come up with this:

Code PHP:
    Get YouTube MP4 URL from URL
    $yt        = $_GET['yt'];
    if (eregi('([url]http://[a-zA-Z\.]*youtube\.com/watch[/url])', $yt)){    // Ensure provided URL is of valid format
        if (function_exists('curl_init')){
            $c = curl_init();
            curl_setopt ($c, CURLOPT_URL, $_GET['yt']);
            curl_setopt ($c, CURLOPT_VERBOSE, 0);
            curl_setopt ($c, CURLOPT_RETURNTRANSFER, 1);
            $content = curl_exec($c);
            if (curl_errno($c) <> 0) {
                echo 'Error reading page';
                echo curl_error($c);
        } else {
            $content = file_get_contents($yt);
        $pattern     = '<meta name="title" content="(.?)*">';
        preg_match($pattern, $content, $matches);
        $name        = substr($matches[0], 27, -1);
        preg_match('~var swfArgs = {(.*?)}~', $content, $match);
        $json = json_decode('{' . $match[1] . '}');
        $id        = $json->video_id;
        $t        = $json->t;
        $time    = $json->l;
        preg_match('~var isHDAvailable = (.*?);~', $content, $match);
        $isHDAvailable    = $match[1];
        if ($isHDAvailable == 'true'){
            $fmt    = 22;
        } else {
            $fmt    = 18;
        echo "$fmt&video_id=$id&t=$t";
    } else {
        echo 'ERROR: Invalid URL Sent';

This is probably far from the best way to do it, but it works. BUT, there is a problem now, as of yesterday, and I need to find a solution. Basically, the process goes something like this (the URLs expire BTW):

Original YouTube URL:

Generated URL:

Redirects to: .C92D9B4C27F848E914CAC0AE80EAFD67FA8B1470&sver=3&expire=1238940802&key=yt1&ipbits=0

Recently it seems that YouTube have started to restrict access to the video to the IP of the machine that requested it. This means that if you make the JavaScript above in to a link and drag it to your shortcut bar that you can click it on the YouTube page and you will be prompted to download the video. It also means that if I run my script on my machine that I get a working URL, which I can use in other places on the web to allow me to download it, but nobody else can use it. Changing the IP is not good enough.

A solution? Well I figure that if I can have a file that acts as a proxy on my server, that requests the file, so my web server's IP is recorded, and then streams the video through, then anyone will be able to watch the video. But is this feasible, and if so, how do I do it?

Many thanks for your help guys