Activity Stream
48,167 MEMBERS
6790 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 5 of 5
  1.     
    #1
    Member

    Default Php Youtube video Download Error

    Error: Warning: file_get_contents(http://www.youtube.com/watch?v=VH5qQKQuuM): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home2/wepkcom1/public_html/data/leechv/functions.php on line 30

    Fatal error: Error while retreiving video page in /home2/wepkcom1/public_html/data/leechv/functions.php on line 31



    PHP Code: 
    <?php

    ini_set
    ('error_reporting',     -1);
    ini_set('display_errors',    true);
    ini_set('max_execution_time',   0);
    ini_set('ignore_user_abort'true);
    ini_set('include_path',       '.');
    ini_set('user_agent''Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0');


    if ( !
    defined('__DIR__') ) define('__DIR__'dirname(__FILE__));
    require_once 
    'Zend/Loader/Autoloader.php';
    Zend_Loader_Autoloader::getInstance();

    // Youtube Developer Key

       
    const YT_DEV_KEY  ''***************'***************';

    // Facebook Application ID
    const FB_APP_ID     '***************';

    // Facebook Application Secret
    const FB_APP_SECRET '71fa4383bdc9459e82b7b6262be3e381';


    function 
    youtube_download($videoId$targetDir$jsProgressCallback null)
    {

        if(!
    $page file_get_contents('http://www.youtube.com/watch?v=' $videoId)) {
            
    trigger_error('Error while retreiving video page'E_USER_ERROR);
        }
        if(!
    preg_match("/yt\.playerConfig\s\=\s(?<config>.*?)\;\s*?yt\.setConfig/s"$page$matches)) {
                
    trigger_error('Unable to find PLAYER_CONFIG'E_USER_ERROR);
        }
        
        
        if(!
    $config json_decode($matches['config'])) {
            
    trigger_error('Malformed PLAYER_CONFIG'E_USER_ERROR);
        }
        

        
    $fmts explode(','$config->args->url_encoded_fmt_stream_map);
        
        
        foreach( 
    $fmts as $k => $v ) { parse_str($v$fmts[$k]); }
        

             
        
    $fmtToDl $fmts[1];

        
    $ch curl_init($fmtToDl['url']);
        
        
    $targetPath $targetDir '/' $videoId '.flv';
        
        
        
    curl_setopt($chCURLOPT_FILEfopen($targetPath'w'));
        
        
    curl_setopt($chCURLOPT_FAILONERRORtrue);
        
        if (
    $jsProgressCallback) {
        

            
    curl_setopt($chCURLOPT_NOPROGRESSfalse);
            
    curl_setopt($chCURLOPT_PROGRESSFUNCTION, function($dlsize$dled) use ($jsProgressCallback) {
                
                static 
    $lastUpdate 0;
                
                @
    $progress round($dled $dlsize 100);
                
                if( 
    $progress $lastUpdate ) {
                
                    echo 
    "<script>{$jsProgressCallback}({$progress});</script>" str_repeat(' '1024);    
                    
                    
    flush(); @ob_flush();
                    
                    
    $lastUpdate $progress;
                    
                }
                
                return 
    0;
                
            });
            
        }

        if (!
    curl_exec($ch)) {
            
    trigger_error('Curl error:' curl_error($ch), E_USER_ERROR);
        }
        
        return array( 
            
    'path' => $targetPath,
            
    'type' => $fmtToDl['type'],
        );
        
        
    }

    function 
    youtube_upload($videoFile$videoType$username$password)
    {
        
    $httpClient Zend_Gdata_ClientLogin::getHttpClient(
            
    $username$password
            
    'youtube'null'LeechVid'nullnull
            
    'https://www.google.com/accounts/ClientLogin'
        
    );
        
        
    $yt = new Zend_Gdata_YouTube($httpClient123nullYT_DEV_KEY);
        
    $yt->setMajorProtocolVersion(2);
        
        
    $videoEntry = new Zend_Gdata_YouTube_VideoEntry;
        
    $videoEntry->setMediaSource(
            
    $yt->newMediaFileSource($videoFile)
                ->
    setContentType($videoType)
                ->
    setSlug('Change.Me')
        );
        
        
    $videoEntry->setVideoTitle('Change Me!');
        
    $videoEntry->setVideoDescription('Edit Me!');
        
    $videoEntry->setVideoCategory('Comedy');
        
        
    $newEntry $yt->insertEntry(
             
    $videoEntry
            
    'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads',
            
    'Zend_Gdata_YouTube_VideoEntry'
        
    );
        
        return 
    $newEntry;
    }

    function 
    facebook_download($fb$videoId$targetDir$jsProgressCallback)
    {
        
    $video    $fb->api($videoId);
        
    $videoSrc $video['source'];
        
        
    $ch curl_init($videoSrc);
        
    $targetFile $targetDir '/' basename(parse_url($videoSrcPHP_URL_PATH));
        
        
    curl_setopt_array($ch, array(
            
    CURLOPT_FILE                => fopen($targetFile'w'),
            
    CURLOPT_FAILONERROR         => true,
            
    CURLOPT_NOPROGRESS          => false,
            
    CURLOPT_USERAGENT           => $_SERVER['HTTP_USER_AGENT'],

            
    CURLOPT_PROGRESSFUNCTION => function($dlsize$dled) use ($jsProgressCallback
            {
                static 
    $lastUpdate 0;
                
                @
    $progress round($dled $dlsize 100);
        
                if( 
    $progress $lastUpdate ) {
                    echo 
    "<script>{$jsProgressCallback}({$progress});</script>" str_repeat(' '1024);            
                    
    flush(); @ob_flush();
                    
    $lastUpdate $progress;
                }
                
                return 
    0;
            }
        ));
            

        if (!
    curl_exec($ch)) {
            
    trigger_error('Curl error:' curl_error($ch), E_USER_ERROR);
        }
        
        return array(
            
    'path' => $targetFile,
            
    'type' => 'video/mp4',
        );
        
        
    }

    function 
    santabanta_download($videoId$targetDir$jsProgressCallback null)
    {

        if(!
    $page file_get_contents('http://www.santabanta.com/video.asp?video=' $videoId)) {
            
    trigger_error('Error while retreiving video page'E_USER_ERROR);
        }
        if(!
    preg_match('/clip\:\s\{\s*url\:\s\"(?<url>.*?)\"\,/s'$page$matches)) {
                
    trigger_error('Unable to find video url'E_USER_ERROR);
        }

        
    $ch curl_init($matches['url']);
        
        
    $targetPath $targetDir '/' $videoId '.flv';
        
        
    curl_setopt($chCURLOPT_FILEfopen($targetPath'w'));
        
        if (
    $jsProgressCallback) {
        
            
    curl_setopt($chCURLOPT_FAILONERRORtrue);
            
    curl_setopt($chCURLOPT_NOPROGRESSfalse);
            
    curl_setopt($chCURLOPT_PROGRESSFUNCTION, function($dlsize$dled) use ($jsProgressCallback) {
                
                static 
    $lastUpdate 0;
                
                @
    $progress round($dled $dlsize 100);
                
                if( 
    $progress $lastUpdate ) {
                
                    echo 
    "<script>{$jsProgressCallback}({$progress});</script>" str_repeat(' '1024);    
                    
                    
    flush(); @ob_flush();
                    
                    
    $lastUpdate $progress;
                    
                }
                
                return 
    0;
                
            });
            
        }

        if (!
    curl_exec($ch)) {
            
    trigger_error('Curl error:' curl_error($ch), E_USER_ERROR);
        }
        
        return array( 
            
    'path' => $targetPath,
            
    'type' => 'video/x-flv',
        );
        
    }
    HyDra_92 Reviewed by HyDra_92 on . Php Youtube video Download Error Error: Warning: file_get_contents(http://www.youtube.com/watch?v=VH5qQKQuuM): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home2/wepkcom1/public_html/data/leechv/functions.php on line 30 Fatal error: Error while retreiving video page in /home2/wepkcom1/public_html/data/leechv/functions.php on line 31 <?php ini_set('error_reporting', -1); ini_set('display_errors', true); Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    sborg.us
    Error: Warning: whatAreYouExpecting(???) failed to make sense : HTTP request failed! HTTP/1.0 404 Not Found in /Ahem_Ahem.php on line 1

    Check the Youtube Link: "This video does not exist. Sorry about that."

    V3g3ta | Halcyon | Abhi

  4.     
    #3
    Member
    Now this error

    Fatal error: Curl error:The requested URL returned error: 403 in /home2/wepkcom1/public_html/data/leechv/functions.php on line 88

    ---------- Post added at 02:51 PM ---------- Previous post was at 02:50 PM ----------

    Fatal error: Curl error:Failed to connect to 2607:f8b0:4007:13::7: Network is unreachable in /home2/wepkcom1/public_html/data/leechv/functions.php on line 88

  5.     
    #4
    Member
    Website's:
    sborg.us
    Curl error 403 means you're not allowed to access the resource - it is forbidden.

    I believe it is a cookie/session issue. You might wanna contact the developer.

    V3g3ta | Halcyon | Abhi

  6.     
    #5
    Member
    i think its sdk or some other problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 17th Nov 2012, 04:54 AM
  2. easily download youtube video
    By mafuz62 in forum General Discussion
    Replies: 21
    Last Post: 23rd May 2012, 04:49 AM
  3. youtube video download help
    By Black Tiger in forum General Discussion
    Replies: 1
    Last Post: 19th Jan 2012, 12:03 AM
  4. Get a YouTube video URL in PHP
    By JmZ in forum Web Development Area
    Replies: 1
    Last Post: 19th Nov 2011, 09:51 PM
  5. Replies: 19
    Last Post: 29th Oct 2010, 06:38 AM

Tags for this Thread

BE SOCIAL