Hello! Help me please.

I can not register on the site programmatically. Tried 2 methods - did not work.

html_tag:=WebBrowser1.OleObject.Document.forms.item(0).elements; for i:=0 to (html_tag.length-1) do begin if (html_tag.item(i).name='user') then html_tag.item(i).value:='*********'; if (html_tag.item(i).name='pswd') then html_tag.item(i).value:='***********' ; if (html_tag.item(i).tagname = 'button') and (html_tag.item(i).type = 'submit') then html_tag.item(i).click; 

2 way to POST . Also issued an error. Here is the code:

 var LoginInfo: TStringList; Response: TStringStream; begin try LoginInfo := TStringList.Create; Response := TStringStream.Create(''); LoginInfo.Add('username=MyName'); LoginInfo.Add('password=MyPass'); IdHTTP1.Post('http://mywebsite.xxx/login.php',LoginInfo,Response); Showmessage(Response.DataString); finally begin Response.Free; LoginInfo.Free; end; end; end; 

Here is what HTTP Analyzer caught:

 midAuth 0,1 user *********** pswd *********** GUID1801934821098200 https://*************:8443/bgbilling/webexecuter 

But the code that requires authorization.

 <form action="webexecuter" method="post"> <input value="0,1" name="midAuth" type="hidden"> <table class="filter"> <tbody> <tr> <td width="100" align="left">Номер договора или логин:</td> <td> <input class="inputLogin" size="15" name="user" type="text"> </td> </tr> <tr> <td width="100" align="left">Пароль:</td> <td> <input class="inputPassword" size="15" name="pswd" type="password"> </td> </tr> <tr> <td></td> <td style="text-align: right"> <input id="GUID1801934821098225" name="GUID1801934821098225" type="hidden"> <button onclick="jQuery('#GUID1801934821098225')[0].form.submit()" type="submit" class="gradbtn blue" id="">Вход</button> </td> </tr> <tr> <td align="right" colspan="2"> <a style="font-size: x-small" href="pubexecuter?action=PasswordForgot&module=admin">Забыли пароль?</a> </td> </tr> </tbody> </table> </form> 

    2 answers 2

    In your HTML form, the password field is called pswd (name="pswd") , and you use password in your code.

     <input class="inputPassword" size="15" name="pswd" type="password"> 
    • I copied this from the template into the code like this (name = "pswd") and entered it. - Arsen
    • When using IdHTTP1, is it possible to configure cookies? By the way, by what principle is the GUID *** field displayed? Maybe it is constantly different, and therefore does not occur authorization? - nolka
      HTTP:= TIdHTTP.Create(nil); HTTP.Request.Authentication.Free; HTTP.Request.Authentication:= IdAuthentication.TIdBasicAuthentication.create; HTTP.Request.Authentication.Username:='user'; HTTP.Request.Authentication.Password:='pass'; HTTP.Post('http://mysite.com','здесь данные&которые&надо&передать'); 
    • Thank you, I will check the account GUID - Arsen