Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
[Delphi] Indy https не могу получить куки |

23.05.2010, 15:37
|
|
Познающий
Регистрация: 25.10.2008
Сообщений: 52
Провел на форуме: 1160666
Репутация:
48
|
|
[Delphi] Indy https не могу получить куки
Пишу регер асеку, не могу получить куки в чем проблема, помогите?
Код HTML:
procedure TForm1.Button1Click (Sender : TObject);
var file1: textfile;
i: integer;
link: String;
Idhttp1 : TIdHttp;
IdHandler: TIdSSlIOHandlerSocketOpenSSl;
p : Integer;
stream : TFileStream;
begin
Button1.Enabled := false;
Button3.Enabled := false;
idhttp1 := Tidhttp.Create(nil);
IdHandler := TIdSSLIOHandlerSocketOpenSSl.create(nil);
IdSSLIOHandlerSocketOpenSSL1VerifyPeer ;
Idhttp1.IOHandler := IDHandler;
cook:= TIdCookieManager.Create(idHttp1);
IdHttp1.CookieManager := cook;
Idhttp1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHttp1.Request.Host:='www.icq.com:443';
IdHttp1.Request.Referer:= 'https://www.icq.com/register/';
IdHttp1.Request.UserAgent:='Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.10)
Gecko/2009042316 Firefox/3.0.10';
IdHttp1.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
IdHttp1.Request.AcceptLanguage:='ru,en-us;q=0.7,en;q=0.3';
//IdHttp1.Request.RawHeaders.Values['Keep-Alive']:='115';
IdHttp1.Request.AcceptCharSet:='iso-8859-1, utf-8, utf-16, *;q=0.1';
IdHttp1.Request.Connection:='keep-alive';
IDHttp1.HandleRedirects := true;
Idhttp1.AllowCookies := true;
try
s := idhttp1.get('https://www.icq.com:443/register'); finally
end;
ch := Copy(s , p+15 , 96); l
ink := 'https://www.icq.com/img/aa_img.php?gnm=' + ch;
p := pos('icq_ln', s);
t := copy(s, p+15, 64);
stream := TFileStream.Create(extractfilepath(paramstr(0)) + '\captcha.jpg', fmcreate);
try
idhttp1.get(link, stream);
finally
end;
stream.free;
image1.Picture.LoadFromFile (extractfilepath(paramstr(0)) + 'captcha.jpg');
Button3.Enabled := true;
end;
procedure TForm1.Button3Click (Sender : TObject);
var
multi: TStringList;
str: String;
file1: TextFile;
i: Integer;
cook_ic: String;
begin
Button1.Enabled := False;
Button3.Enabled := False;
idhttp1 := Tidhttp.Create(nil);
IdHandler := TIdSSLIOHandlerSocketOpenSSl.create(nil);
Idhttp1.IOHandler := IDHandler;
IDHttp1.HandleRedirects := true;
Idhttp1.AllowCookies := true;
IdHttp1.Request.Host:='www.icq.com';
IdHttp1.Request.UserAgent:='Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.10)
Gecko/2009042316 Firefox/3.0.10';
IdHttp1.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
IdHttp1.Request.AcceptLanguage:='ru,en-us;q=0.7,en;q=0.3';
IdHttp1.Request.AcceptCharSet:='windows-1251,utf-8;q=0.7,*;q=0.7';
IdHttp1.Request.Connection:='keep-alive';
IdHttp1.Request.Referer := 'https://www.icq.com/register/';
IdHttp1.Request.ContentLength := 400;
multi.Add('service=30');
multi.Add('icq_ln='+t);
multi.Add('nickname='+ Edit1.Text);
multi.Add('fname='+edit2.Text);
multi.Add('lname='+Edit3.Text);
multi.Add('email='+ Edit4.Text);
multi.Add('password='+ Edit6.Text);
Multi.Add('password_confirm='+ Edit6.Text);
multi.Add('qa1='+ ComboBox2.Text);
multi.Add('answer1='+ Edit9.Text);
multi.Add('word='+ Edit10.text);
multi.Add('lang=en');
multi.Add('gnm='+ch);
str := idhttp1.post ('https://www.icq.com/register/index.php', multi);
end;
Пробовал в ручную прописывать куки так:
Код HTML:
idhttp1.CookieManager.CookieCollection.AddsrcCookie('geo=7;');
idhttp1.CookieManager.CookieCollection.AddsrcCookie('icq_ln='+t+';');
idhttp1.CookieManager.CookieCollection.AddsrcCookie('icq_lang=ru;');
idhttp1.CookieManager.CookieCollection.AddsrcCookie('s_cc=true;');
idhttp1.CookieManager.CookieCollection.AddsrcCookie('s_sq=aolwpicq%3D%2526pid%253Dicq%252520%25253A%252520Help%252520-
%252520Registration%252520-%252520Index%2526pidt%253D1%2526oid%253DSubmit%2526oidt%253D3%2526ot%253DSUBMIT;');
Все равно регистрация не происходит
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|