0

I want to create a tool to download files from the website in the following order :

  1. Users enter 'username ' and ' password '
  2. Cookies are stored
  3. Keep Session Cookies
  4. Download the file

Until now, to perform the above tasks , I use ' wget ' with the script :

wget --user-agent="Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1" --post-data="username=%id%&password=%password%&sublogin=Login" --save-cookies="cookies\cookies.txt" --keep-session-cookies http://%app%/login/login/loging_simpel

how do I do that with Delphi?

flyingbird013
  • 446
  • 2
  • 12
  • 28

1 Answers1

0

You can use the Indy TIdHTTP component for that:

IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1';
PostData := TStringList.Create;
try
  PostData.Add('username='+Username);
  PostData.Add('password='+Password);
  PostData.Add('sublogin=Login');
  IdHTTP1.Post('http://'+app+'/login/login/loging_simpel', PostData);
finally
  PostData.Free;
end;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770