
22.12.2009, 13:34
|
|
Banned
Регистрация: 25.11.2007
Сообщений: 62
Провел на форуме: 1702086
Репутация:
89
|
|
Код:
function test_log_vk (name, pass : string) : string;
var
http : Tidhttp;
s : string;
post : Tstringlist;
coo : Tidcookiemanager;
compressor : tidCompressorZLib;
begin
coo := Tidcookiemanager.Create;
http := Tidhttp.Create; http.ReadTimeout := 60000; http.AllowCookies := true; http.HandleRedirects := false; http.CookieManager := coo; http.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'; http.Request.AcceptEncoding := 'gzip,deflate';
compressor := tIdCompressorZLib.Create; http.Compressor := compressor;
post := Tstringlist.Create;
http.get ('http://vk.com');
post.add ('op=a_login_attempt');
http.post ('http://vk.com/login.php', post);
post.Clear;
post.add ('email=' + name);
post.add ('pass=' + pass);
post.add ('expire=');
post.add ('vk=1');
s := http.post ('http://login.vk.com/?act=login', post);
post.Clear;
post.Add ('op=slogin');
post.Add ('redirect=1');
post.Add ('expire=0');
post.Add ('to=');
post.Add ('s=' + copy (s, 536, 56));
try
http.post ('http://vk.com/login.php', post);
except end;
if http.Response.Location = 'profile.php' then Result := 'remixsid=' + copy (s, 536, 56) else result := 'false';
http.Free; coo.Free; post.Free; compressor.Free;
end;
Код от руки писаный, но работает. Возвращает remixsid из кукисов (для авторизации больше ничего и не нужно).
|
|
|