How To get vimeo video thumubanil using php?

Discussion in 'PHP' started by ShinoRex, Nov 27, 2011.

  1. #1
    Hi all.. Please anyone help me to get vimeo thumbnail to show in my blog post? I'm looking for a php function where it ll take vimeo video id as parameter and ll return its thumbnail Thanks in advance.
     
    ShinoRex, Nov 27, 2011 IP
  2. Qarizma

    Qarizma Member

    Messages:
    55
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    45
    #2
    Google found this:

    
    function getVimeoThumb($videoid,$size) {
        $url = "vimeo.com/api/clip/".$videoid."/php/";
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        // grab URL and pass it to the browser
        $data = curl_exec($ch);
        curl_close($ch);
        $finaldata = unserialize($data);
        
        return '';
    }
    
    PHP:
    or

    
        $video_url = "http://vimeo.com/7811853"  
        $file = fopen($video_url, "r");
        $filedata = stream_get_contents($file);
        $html_content = strpos($filedata,"<link rel=\"videothumbnail");
        $link_string = substr($filedata, $html_content, 128);
        $video_id_array = explode("\"", $link_string);
        $thumbnail_url = $video_id_array[3];
        echo $thumbnail_url;
    PHP:
    or

    
    $imgid = 6271487;
    
    $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$imgid.php"));
    
    echo $hash[0]['thumbnail_medium'];  
    
    PHP:
     
    Qarizma, Nov 27, 2011 IP
  3. ShinoRex

    ShinoRex Well-Known Member

    Messages:
    227
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    148
    #3
    Vow..!!! Great Qarizma... Thanx a lot... Let me try this methods..... Thanks a lot again....
     
    ShinoRex, Nov 27, 2011 IP