Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses
- IdHTTP, IdSSLOpenSSL;
- function TfrmMain.Login: string;
- var
- IdHTTP: TIdHTTP;
- Request: TStringList;
- Response: TMemoryStream;
- SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
- begin
- Result := '';
- try
- Response := TMemoryStream.Create;
- try
- Request := TStringList.Create;
- try
- Request.Add('op=login');
- Request.Add('redirect=http://newyork.craigslist.org/');
- Request.Add('login=' + myEmail);
- Request.Add('password=' + myPassword);
- IdHTTP := TIdHTTP.Create;
- try
- SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
- try
- SSLHandler.SSLOptions.Method := sslvSSLv3;
- SSLHandler.SSLOptions.Mode := sslmUnassigned;
- IdHTTP.IOHandler := SSLHandler;
- IdHTTP.AllowCookies := True;
- IdHTTP.HandleRedirects := True;
- IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
- IdHTTP.Post('https://accounts.craigslist.org/login', Request, Response);
- Result := IdHTTP.Get('https://accounts.craigslist.org/');
- finally
- SSLHandler.Free;
- end;
- finally
- IdHTTP.Free;
- end;
- finally
- Request.Free;
- end;
- finally
- Response.Free;
- end;
- except
- on E: Exception do
- ShowMessage(E.Message);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment