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

  #17  
Старый 10.03.2009, 17:19
Kaimi
Познавший АНТИЧАТ
Регистрация: 23.08.2007
Сообщений: 1,237
С нами: 9851426

Репутация: 1676


По умолчанию

Попробуй
PHP код:
<?

$id 
= '123456';
$email = 'test@mail.ru';
$pass = 'test';
$remixsid = '.....';

$ck = 'remixmid='.$id.'; remixemail='.urlencode($email).'; remixpass='.md5($pass).'; remixsid='.$remixsid;

$data = socket_do('vkontakte.ru', 0, '/id'.$id, 'Firefox', $ck, 1, 'GET', '', 1, 0, 0);
preg_match("/act=online(.{1,40})\((\d+)\)<\/a>/", $data, $ret);
$online = $ret[2];
preg_match("/activityhash' value='(\S{32})'/", $data, $ret);
$hash = $ret[1];

socket_do('vkontakte.ru', "setactivity=".surlenc(to_unicode('Друзей онлайн: ')).$online."&activityhash=".$hash, '/id'.$id, 'Firefox', $ck, 1, 'POST', '', 1, 0, 0);


function 
to_unicode($text,$from='w')
{
  
$text=convert_cyr_string($text,$from,'i');
  
$uni='';

  for(
$i=0, $len=strlen($text); $i<$len; $i++)
  {
    
$char=$text{$i};
    
$code=ord($char);
    
$uni.=($code>175) ? "&#".(1040+($code-176)).";" : $char;
  }

  return 
$uni;
}

function 
surlenc($msg)
{
  
$msg=str_replace(array('%','&','+','?'),array('%25','%26','%2B','%3F'),$msg);
  return 
$msg;
}

function 
socket_do($host,$vars,$service_uri,$browser,$cookies='',$sread=1,$method='POST',$ref='',$addheaders=1,$proxy=false,$proxyport=0,$HTTP='1.0')
{
  
$ret="";

  if(
$method=='GET' && $vars)
  {
    
$service_uri.='?'.$vars;
    
$vars='';
  }

  
$header="Host: $host\r\n";
  
$header.="User-Agent: $browser\r\n";

  if(
$addheaders==1)
  {
    
$header.="Content-Type: application/x-www-form-urlencoded\r\n";
    
$header.="Content-Length: ".strlen($vars)."\r\n";
  }
  else if(
$addheaders==0)
  {
    
$header.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
    
$header.="Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
    
$header.="Accept-Encoding: \r\n";
    
$header.="Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
  }
  else if(
$addheaders==2)
  {
    
$header.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
    
$header.="Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
    
$header.="Accept-Encoding: \r\n";
    
$header.="Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
    
$header.="Pragma: no-cache\r\n";
    
$header.="Cache-Control: no-cache\r\n";
    
$header.="Content-Length: ".strlen($vars)."\r\n";
    
$header.="Content-Type: application/x-www-form-urlencoded; charset=windows-1251\r\n";
  }
  else if(
$addheaders==3)
  {
    
$header.="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
    
$header.="Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
    
$header.="Accept-Encoding: gzip,deflate\r\n";
    
$header.="Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
  }


  if(
$ref) $header.="Referer: $ref\r\n";

  
$header.="Connection: close\r\n";

  if(
$cookies)
    
$header.="Cookie: $cookies\r\n";

  
$header.="\r\n";


  if(
$proxy)
  {
    
$addquery="$method http://$host$service_uri  HTTP/$HTTP\r\n";
    
$fp=fsockopen("tcp://".$proxy,$proxyport,$errno,$errstr,30);
  }
  else
  {
    
$addquery="$method $service_uri  HTTP/$HTTP\r\n";
    
$fp=fsockopen("tcp://".$host,80,$errno,$errstr,30);
  }

  
stream_set_timeout($fp,30);

  if(!
$fp)
  {
    print 
"addMes('<font color=red>Socket error: <i>$errstr ($errno)</i></font><br>');nextAcc();";
    exit();
  }



  
fputs($fp,$addquery);
  
fputs($fp,$header.$vars);


  if(
$sread)
  {
    while(!
feof($fp))
    {
      
$ret.=fgets($fp, 128);
    }
  }

  
fclose($fp);



  return 
$ret;
}
?>
 
Ответить с цитированием