Jump to content

Parse FLV from anothrer server to user.


cgimusic

Recommended Posts

You want to download or play?

 

You can do both without curl or readfile

 

If your trying to open a remote flv file with readfile itll show crap, youll have to do that with curl, and its really quite simple, i usually transfer flv files between my 2 servers using curl

 

You can get alot of info about a flv file without downloading it like this one:

 

$ch = curl_init($remote);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
$data = curl_exec($ch);
curl_close($ch);
if ($data === false) {
  echo 'cURL failed';
  exit;
}

$contentLength = 'unknown';

if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {
  $contentLength = (int)$matches[1];
}

$filesize = round((($contentLength / 1224) / 1224)) + 4;
//echo $filesize;

if($filesize < 100){
echo "Im over 100MB";
}else{
echo "Im under 100MB";
}

 

 

Link to comment
Share on other sites

It probably expired. Here is my script currently.

<?php
error_reporting(E_ALL);
$file = file("http://www.youtube.com/watch?v=".$_GET["id"]);
for ($count=0;$count<count($file);$count+=1) {
if (preg_match('/.*?(var swfArgs)/',$file[$count])) {
	$linestring=$file[$count];
};
};
$url=explode("\"",$linestring);
$count=1;
while(isset($url[$count])&&!$url[$count]==""){
$vars[$url[$count]]=$url[$count+2];
$count=$count+4;
};
echo "http://www.youtube.com/get_video?video_id=".$_GET["id"]."&t=".$vars["t"];
//$ch=curl_init("http://www.youtube.com/get_video?video_id=".$_GET["id"]."&t=".$vars["t"]);
//curl_exec($ch);
//curl_close($ch);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.