Witam, jak rozwiazac sprawe logowania, np. na Rapidshare.com, w delphi? Chcialbym napisac program ktory loguje sie na serwerze, dane dostepowe moga byc w kodzie, ..... jak to jest rozwiazane np. w programie rapget ?
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tam
procedure TForm1.Button1Click(Sender: TObject);
var
HTTP: TidHTTP;
html, s: string;
i: integer;
StreamIn: TStringStream;
begin
HTTP := TidHTTP.Create(nil);
StreamIn:= TStringStream.Create('');
HTTP.IOHandler:= Form1.IdSSLIOHandlerSocket1;
Http.Request.UserAgent:= 'Mozilla/5.0 (Windows; U; Windows NT 5.0; pl-PL; rv:1.7.6) Gecko/20050226 Firefox/1.0.1';
StreamIn.WriteString('uselandingpage=1&login=******&password=*****');
try
HTTP.HandleRedirects := True;
HTTP.AllowCookies := True;
HTTP.Request.ContentType :='application/x-www-form-urlencoded';
html := HTTP.Post('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi',StreamIn);
s := 'Cookies: ';
if HTTP.CookieManager.CookieCollection.Count > 0 then
for i := 0 to HTTP.CookieManager.CookieCollection.Count - 1 do
s := s + HTTP.CookieManager.CookieCollection.Items[i].CookieText;
Memo1.Lines.Add(s);
// Cookies: user=login-zakodowanehaslo; path=/; domain=.rapidshare.com
memo1.Lines.add(HTTP.response.ResponseText);
//HTTP/1.1 200 OK
memo1.Lines.add(HTTP.Request.RawHeaders.Text);
// Content-Type: application/x-www-form-urlencoded
// Content-Length: 46
// Host: ssl.rapidshare.com:443
// Accept: text/html, */*
// User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; pl-PL; rv:1.7.6) Gecko/20050226 Firefox/1.0.1
finally
FreeAndNil(HTTP);
end;
end;
uselandingpage=1&login=xxx&password=xxx
input:=tstringstream.Create('');
ms:=tstringstream.Create('');
input.WriteString('uselandingpage=1&login=6349934+&password=gDT6hDDjms');
idhttp1.Post('https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi',input,ms);
memo1.Text:=ms.DataString;
ShellExecute(Handle, 'open', 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?uselandingpage=1&login=6349934+&password=gDT6hDDjms', nil, nil, SW_SHOWNORMAL);