Warning: filemtime(): stat failed for ./data/secure/tokens/23fee7103b8e277e687de661883c15dc35d460c80df6b113ab35f2f385de4d4db1d08ddf957e0fe1a6698876005b66f34665b0129096ee83dfc42bdc9f1a8891.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831

Warning: filemtime(): stat failed for ./data/secure/tokens/3f480c2bf85eac6b50dbc91d51d2af0369bddb52c6f3f8c77a32de3a8a9249f351152b617df56ad54c00fe618ac0fd4380d3185ff7ac4df9a44f0cc0dc5544ef.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831

Warning: filemtime(): stat failed for ./data/secure/tokens/404d6893db3e28fcd6f974333f4d35cbc8730b13133a009469bc16e459691f9a826d8bf82c89b63a7bdab2d0049a1aaf5d7ecd917c0ea51ce789085cf58c5001.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831

Warning: filemtime(): stat failed for ./data/secure/tokens/4cd5c18efd45fd38f68a0acc389978cd0768b339748f7319cf12ffc1ec78e4c70b77562e6b18bcf5a7f56416968e74fa599b42c507a5d7b8cce4cb0d40ca6f55.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831
SnippetVamp - open
#key - get_video_infos - infos sur une video youtube
function file_curl_contents($url,$pretend=true){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Charset: UTF-8'));
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,  FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        if (!ini_get("safe_mode") && !ini_get('open_basedir') ) {curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);}
        curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
        if ($pretend){curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/29.0');}
    
        curl_setopt($ch, CURLOPT_REFERER, '');
        $data = curl_exec($ch);
        $response_headers = curl_getinfo($ch);

        // Google seems to be sending ISO encoded page + htmlentities, why??
        if($response_headers['content_type'] == 'text/html; charset=ISO-8859-1') $data = html_entity_decode(iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $data)); 
        
        # $data = curl_exec($ch);

        curl_close($ch);

        return $data;
    }


function get_video_infos($url=null){
	// returns an array with all the youtube video's informations (available qualities/urls/format...)
	if (!empty($url)){
		if ($contenu=file_curl_contents($url)){
			preg_match_all('#"url_encoded_fmt_stream_map": "(.*?)"#', $contenu, $resultats);
			preg_match_all('#(.*?)#', $contenu, $title);
			$c=0;
			$p=array('title'=>$title[1][0]);
			$params=explode('\u0026',$resultats[1][0]); 
			foreach ($params as $param){
				$temp=explode('=',$param);
				if (isset($p[$c][$temp[0]])){$c++;}
				$p[$c][$temp[0]]=urldecode($temp[1]);
			}
			return $p;
		}else{return false;}
	}else{return false;}

}


echo '
';print_r(get_video_infos('http://www.youtube.com/watch?v=oHg5SJYRHA0'));