I am trying to login to a website via delphi / indy. Currently all I have is a button (used to send a password / username) it calls this procedure.
procedure TForm5.Login(name: string; Pass: string);
var
UserID :string;
Password :string;
res :TStringStream;
details :Tstringlist;
multiformupload: TIdMultiPartFormDataStream;
begin
//create ini file to hold password / usesr name
UserID:=name;
Password:=pass;
Res := TStringStream.Create();
MultiFormUpload := TIdMultiPartFormDataStream.Create;
MultiFormUpload.AddFormField('user',UserID);
MultiformUpload.AddFormField('pass',Password);
idhttp1.Request.ContentType := '8bit';
//idhttp1.Get('http://codeelf.com',res);
idhttp1.Post('http://codeelf.com/games/the-grid-2/grid',Multiformupload,res);
memo1.Lines.LoadFromStream(res);
res.Free;
end;
When I look at the site code, i have this.
<form id="gridForm" action="" method="post" onsubmit="return checkLoginForm()">
<table align="left" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="left" id="my_username">Username:</td>
<td align="right"><input type="text" id="user" name="user" maxlength="12" autocomplete="off" /></td>
</tr>
<tr>
<td align="left" id="my_password">Password:</td>
<td align="right"><input type="password" id="pass" name="pass" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2" align="right">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input id="submission" type="submit" class="button" name="sublogin" value="Login" /></td>
</tr>
So the submission button value is just login. Thus i dont know where to POST the data. How can i find this out? And once i do find out the url, I should just be able to add it to the idhttp1.Post correct?
document.getElementById('submission').click();But how do i call this from idhttp? Is this a javascript? as i see no function called click on the page source - Glen Morse