sign in

Download an encoded video in PHP

Home | RecentChanges | All Pages | Help

You must install the Pear HTTP Request lib, see http://pear.php.net/package/HTTP_Request

<?php
require_once "HTTP/Request.php";
$req =& new HTTP_Request("http://heywatch.com/encoded_video/1000.bin");
$req->setBasicAuth("johndoe", "foo");
$req->sendRequest();
$real_url = $req->getResponseHeader("location");
$video_content = file_get_contents($real_url);
$file = fopen('myvideo.flv', 'wb');
fwrite($file, $video_content);
fclose($file);
?>

Powered by JunebugWiki v0.0.18 Last edited by bruno on March 31, 2007 07:23 PM (diff)
Version 2 (current) «olderversions