|
|
代码是错的。谁能修改好啊~~让它默认下载最清晰的那种格式的。
能弄好的PM我价格吧 或者我还有个MINKDOG的VPS 768内存的的可以续费一哈子再转给你
- <?php
- $url='http://www.有图比.com/watch?v=839DdUWbeLw';;//这边改网址
- get_有图比_url($url); //开始正式执行
- function get_有图比_url($url){ //处理字串的程式
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_URL,$url);
- $content = curl_exec($ch);
- $filename = get_有图比_title($content);//WINDOWS 不支援UTF8 无法使用\\
- $filename = mktime();//因为本人是WINDOWS,所以档名设成时间
- $file_info = get_有图比_info($content);
- $url = 'http://www.有图比.com/get_video?video_id='.$file_info['video_id'].'&t='.$file_info['t'];
- //echo $filename.$url;
- download_有图比($url,$filename);
- }
- function get_有图比_title($content){ //只有在LINUX有用 支援UTF8
- $content = substr($content,strpos($content,'<meta name="title"')+28);
- $content = substr($content,0,strpos($content,'"'));
- return $content;
- }
- function get_有图比_info($content){ //处理影片资讯的程式
- $content = strstr($content,"var swfArgs");
- $content = substr($content,0,strpos($content,';'));
- $return='';
- $content = explode('"',$content);
- foreach($content as $a => $b){
- if($a%4 == 1){
- $return[$b] = $content[$a+2];
- }
- }
- return $return;
- }
- function download_有图比($url,$filename){ //真正下载的程式
- $fh = fopen($filename.'.flv', 'w+');
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);//有图比 可能有转址
- curl_setopt($ch, CURLOPT_FILE,$fh);
- curl_exec($ch);
- fclose($fh);
- }
- ?>
复制代码 |
|