ANTICHAT

ANTICHAT (https://forum.antichat.io/index.php)
-   PHP (https://forum.antichat.io/forumdisplay.php?f=37)
-   -   [PHP] Class Vkontakte (https://forum.antichat.io/showthread.php?t=181007)

Gifts 23.02.2010 16:25

1) Если на личное пользование - то не кажется ли вам, что достаточно было оставить этот класс в прикрепленной теме и не пытаться потешить свое ЧСВ отдельным топиком? Да и все равно пригодится красиво писать код, и читаемо и удобно
2) Да, я имел ввиду юзерапи
3) Нужен, или вы всегда уверены по какой причине возвращается false?
4) Капча на юзерапи заявлена и возможна - http://userapi.com/?act=doc#captcha
5) Панацеи не будет, лучше добавьте поле is_utf внутри класса, и от него пляшите
8) Эээ, с чего бы?

vipfoto 15.05.2010 14:51

Всем здрасти! Делаю загрузку видео на 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";
    }
} 


phpdreamer 15.05.2010 15:15

ТС, добавил тему в закладки в надежде на продолжение...
ставлю +
PS: класс не скачивал, так как пока ничего интересного не реализовано


Время: 18:19