i m using php tube class to download youtube video. Video is automatically downloaded in a folder by submitting youtube video url.
everything is working fine on local (XAMPP), but when i upload this to server(online), THEN ONLY 0 byte flv file is saved.
i also debug the code both side( local and global ).
i get the url like this( on local)
http://www.youtube.com/get_video?video_id=1jNWCFwqPvM&=vjVQa1PpcFMyYCECyfmYENWklpwXGyhVgJpSFPgNAEc%3D
whereas on server i got link like this
http://www.youtube.com/
get_video?video_id=1jNWCFwqPvM&t=vjVQa1PpcFNS3SPxIXi8hy-NF4qZFFrScDXCjGLLrLc%3D
when i copy the link getting from local and paste on browser then a download box appear on browser, whereas when i copy the link getting from server and paste on browser then only a blank page appears
- please solve my problem, where is the error???
- how to know that pear is installed or not on server?
- on server side sometimes i get link like - http://www.youtube.com/get_video?video_id=1jNWCFwqPvM&t=vjVQa1PpcFNS3SPxIXi8hy-NF4qZFFrScDXCjGLLrLc%3D
but sometimes i get only
http://www.youtube.com/get_video?video_id=&t=
please guide me how to solve these?
UPDATE:
i debug all the code and found that file_get_contents() return string(0) on server whereas  on local it return some integer value. allow_url_fopen is onmy server
this is index.php
include_once('functions.php');  
$url =  $_POST['url']; // here is url of youtube video
$pattern = getPatternFromUrl($url); 
$flv_path = GrabFlvFromYoutube($pattern );
echo "File Successfully Downloaded at:".$flv_path."<br/>";
these functions are in functions.php
function getPatternFromUrl($url)
{
$url = $url.'&';
$pattern = '/v=(.+?)&+/';
preg_match($pattern, $url, $matches);
//echo $matches[1]; die;
return ($matches[1]);
}
and
function GrabFlvFromYoutube( $pattern )
{
require_once ("phptube.php");
$tube = new PHPTube ();
$flv_http_path = $tube->download($pattern) ;
    echo "<br/>Complete URL:".$flv_http_path;
set_time_limit(0);
$data = file_get_contents($flv_http_path);  
//var_dump(file_get_contents($flv_http_path));  
$new_flv_path = dirname(_FILE_).'/flvs/'.$pattern.'-'.time().'.flv' ;
echo "<br />File uploaed:";
    file_put_contents($new_flv_path, $data);    
return $new_flv_path ;
}
below function in phptube.php
class PHPTube {
var $cookies;
var $mgr;
var $req; 
var $debug = true;
var $auth = false;
function PHPTube () {}
    function download ($video_id) {
    $url = "http://www.youtube.com/watch?v=".$video_id;     
$this->req =& new HTTP_Request($url);
$response = $this->req->sendRequest();
if (PEAR::isError($response)) {
    $response->getMessage()."\n";
} else {    
        $page = $this->req->getResponseBody();  
    $vpattern = '/v=(.*?)&/';
    //$vpattern ='/video_id:(.*?)/';
    preg_match($vpattern,$page,$mv);
    //preg_match('&"video_id": "(.*?)"&', $page, $mv); 
    echo "<br />Video ID:".$v_id = $mv[1]; 
    //$tpattern='/"t": "(.*?)"/';
    $tpattern = '/&t=(.*?)&/';
    preg_match($tpattern,$page,$tickets);
    echo "<br />Token ID:".$token = $tickets[1];
    $curl = "video_id=";
    $curl .= $v_id;
    $curl .= "&t=";         
    $curl.= $token;
    //echo "<br />Query String:".$curl; die;
    $url = "http://www.youtube.com/get_video?".$curl;  
    if ($this->debug)
     return $url;
     }
   }
 }  
Thanks in advance to all my seniors