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

  #2  
Старый 09.05.2009, 22:23
.:EnoT:.
Постоянный
Регистрация: 29.05.2007
Сообщений: 850
С нами: 9975266

Репутация: 1916


По умолчанию

Короче писать что-то красивое было влом.
Код кривой но работает.

PHP код:

<?php
###########################################

$email = 'mail@mail.ru';
$password = '12345';
$album = 'http://vkontakte.ru/album12345_67890';

###########################################
header('Content-type:text/html; Charset=cp1251');
set_time_limit(0);
function 
curl($get, $post = 0, $cookies = '', $head = 1) {
    
$cl = curl_init($get);
    
curl_setopt($cl, CURLOPT_RETURNTRANSFER, 1);
    
curl_setopt($cl, CURLOPT_HEADER, $head);
    
curl_setopt($cl, CURLOPT_COOKIE, $cookies);
    
curl_setopt($cl, CURLOPT_FOLLOWLOCATION, 0);
    
curl_setopt($cl, CURLOPT_USERAGENT, 'Opera/9.25 (Windows NT 6.0; U; ru)');
    if (
$post) {
        
curl_setopt($cl, CURLOPT_POST, 1);
        
curl_setopt($cl, CURLOPT_POSTFIELDS, $post);
    }
    
$line = curl_exec($cl);
    
curl_close($cl);
    return 
$line;
}
$login = curl('http://vkontakte.ru/login.php', 'op=a_login_attempt&email=' . urlencode($email) . '&pass=' . $password);
preg_match_all('#Set-Cookie:\s([\S]+?);#i', $login, $gets);
$cookies = join(';', $gets[1]);
if (!
stripos($cookies, 'remixpass=')) die('Аккаунт не авторизован');
if (!
file_exists('photos')) mkdir('photos', 0777);
for (
$i = 0; true; $i += 20) {
    
$get = curl($album . '?st=' . $i, 0, $cookies);
    if (!
preg_match_all('#<a\shref="/photo([0-9_]+)">#i', $get, $links)) die();
        foreach (
$links[1] as $link) {
            
$html = curl('http://vkontakte.ru/photo' . $link, 0, $cookies);
            
preg_match('#src="([^"]+(x_[a-z0-9]+\.jpg))"\sid="myphoto"#i', $html, $link);
            
$photo = curl($link[1], 0, 0, 0);
            
$f = fopen('photos/' . $link[2], 'wb');
            
fputs($f, $photo);
            
fclose($f);
        }
    if (!
stripos($get, "class='pageList'")) die();
}

?>
 
Ответить с цитированием