Показать сообщение отдельно

  #12  
Старый 15.05.2010, 14:51
vipfoto
Новичок
Регистрация: 05.01.2010
Сообщений: 1
С нами: 8605023

Репутация: 0
По умолчанию

Всем здрасти! Делаю загрузку видео на PHP. Взял за основу Умный аватар на PHP для ВКонтакте v1.1 . Но выдает сообщение: "Security Breach2". Подскажите, пожалуйста, в чем я ошибаюсь))
PHP код:
include 'config.php';

$email = iconv('utf-8','cp1251',$email);
$pass = iconv('utf-8','cp1251',$pass);
$sid = vk_auth($email, $pass);
$cookies = 'remixsid='.$sid;

$vk_video = vk_video($cookies,'path_to_file/1.flv');

function 
curl($url, $cookie = false, $post = false, $header = false, $follow_location = false) {
    
$ch = curl_init($url);
    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
curl_setopt($ch, CURLOPT_FAILONERROR, true);
    
curl_setopt($ch, CURLOPT_HEADER, $header);
    
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $follow_location);
    if (
$cookie) {
        
curl_setopt ($ch, CURLOPT_COOKIE, $cookie);
    }
    if (
$post) {
        
curl_setopt($ch, CURLOPT_POST, 1);
        
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    
$response = curl_exec ($ch);
    
curl_close($ch);
    return 
$response;
}

function 
vk_auth($email, $pass) {
    
$response = curl('http://vkontakte.ru/login.php',false,array('email'=>$email,'pass'=>$pass),true);
    
preg_match('|Set-Cookie: remixsid=(.*); exp|', $response, $cm);
    return 
$cm[1];
}

function 
vk_video ($cookies, $filename) {
    
$upl_video = curl('http://vkontakte.ru/video.php?act=upload',$cookies);
    
$reg ="#http://cs[0-9]{1,6}\.vkontakte\.ru/upload_video\.php\?act=add_video#";
    
preg_match($reg, $upl_video,$matches);
    
$link = $matches[0];
    if (
strlen($link)>0) {
        
$output = curl($link,$cookies,array('video_file'=>'@'.$filename),true);
        
$reg = "#upload_video.*?callback#";
        
preg_match($reg, $output,$matches);
        
$output = curl('http://vkontakte.ru/'.$matches[0],$cookies);
    } else {
        echo 
"Error!\n";
    }
} 

Последний раз редактировалось vipfoto; 17.05.2010 в 16:45..
 
Ответить с цитированием