Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WEB Authentication

Posted on 2003-11-06
3
Medium Priority
?
210 Views
Last Modified: 2010-08-05
Hi !
I need to make a program where the user will enter the userid and the paassword and the program will Log in to a specific web site.
For Exemple, To access the internet I have to open my IE, type "http://www.veloxzone.com.br/vfile/pages/serviceLogon.jsp?service=internet_TERRA3"
and then manually enter my userid and password.
I want to make a program to do it automatically but I don't know wich component I can use and how to send this information to the web site. the address authetication is:
http://www.veloxzone.com.br/dashboard?fcn=serviceLogon&service=internet_TERRA3&username=XXXXXXXXpassword=XXXXXXX

Any help would be appreciated.
Rodrigo Lira.
PS: Sorry about my english.
0
Comment
Question by:lirageneve
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 1400 total points
ID: 9694051
Try this:
function TForm1.SendPostData(URL, AField1, AField2, AField3, AField4: String): TMemoryStream;
var
 Params: TStringStream;
begin
 Result := TMemoryStream.create;
 Params := TStringStream.create('');

 try
   with IdHTTP1 do
   begin
     Params.WriteString(URLEncode(AField1 + '&'));
     Params.WriteString(URLEncode(AField2));
     Params.WriteString(URLEncode(AField3));
     Params.WriteString(URLEncode(AField4));
     Request.ContentType := 'application/x-www-form-urlencoded';
     try
       Post(URL, Params, Result);
     except
       on E: Exception do
         showmessage('Error encountered during POST: ' + E.Message);
     end;
   end;
 Result.WriteBuffer(#0' ', 1);
 Result.Position := 0;
 except
   Params.Free;
 end;
end;

Usage:
SendPostData('http://www.veloxzone.com.br/dashboard',
             'fcn=serviceLogon',
             'service=internet_TERRA3',
             'username=XXXXXXXX',
             'password=XXXXXXX');

The result of calling the function can be saved, too:
procedure TForm1.btnLoginClick(Sender: TObject);
var
  HTMLStream: TMemoryStream;
begin
  HTMLStream := SendPostData('http://www.veloxzone.com.br/dashboard',
                             'fcn=serviceLogon',
                             'service=internet_TERRA3',
                             'username=XXXXXXXX',
                             'password=XXXXXXX');
  // Now save the result so we may open it in the browser or do ????
  HTMLStream.SaveToFile('c:\mysearch.htm');
  HTMLStream.Free;
end;
0
 

Author Comment

by:lirageneve
ID: 9698011
I think the code is ok, but I still dont know wich component I can use...
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9698483
Indy's  IdHTTP is the component. Included with Delphi6 and above, downloadable from
http://www.nevrona.com/indy for any other version.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question