Actually this is the question, I tried the synapse, but something does not work, who can share the working script?

PS: I ask in Google / Yandex or TP not to send me

  • What does not suit Indy? What exactly does not work? Watched what the browser sends and what your program sends? in Google and Yandex a bunch of ready (working) examples - SoftR
  • @SoftR, your message does not contain a response. - Sh4dow
  • in indie do not arrange curves modules, constantly problems with IdGlobal.pas synapse tried to send requests, but for some reason an incomplete line reached the server> 'act = login & q = 1 & al_frame = 1 & expire = & captcha_sid = & captcha_key = & from_host = vkontakte.ru & email = v' and the whole line looks like this:> 'act = login & q = 1 & al_frame = 1 & expire = & captcha_sid = & captcha_key = & from_host = vkontakte.ru & email =' + edit1.Text + '& pass =' ​​+ edit2.Text I can't figure it out ... - Vladimir Archi
  • PS: what is the most incomprehensible: I tried to make a clicker that will enter the username and password in the fields, but the clicker writes only the login and does not go down to the password (although I tried it on other sites - the clicker does an excellent job) - Vladimir Archi
  • mail = ** v ** 'Where did your line come from? As for Indy's curvature, this is a controversial issue, especially if the task is to work with vkontakte.ru, then Indy is enough for the eyes, I know from my own experience more than a dozen projects for working with contacts have been implemented and all using indy - SoftR

2 answers 2

For authorization on almost any site, you can use the method of sorting HTML code. At first it is better to look at the source code of the page, if it is large, then this method may work too long, but there is a solution: we purposely write the wrong password, then the browser will transfer us to another page, there the HTML code will be less, therefore we will authorize it programmatically on it. Create a project and throw two buttons on the form and a WebBrowser component from the Internet tab; The first button is needed to open the page, and the second is for authorization.

Code

  // for the button to open the site
 procedure TAutorizationForm.BitBtnOpenPageClick (Sender: TObject);
 begin
 WebBrowser.Navigate ('here we write the desired site');
 end; 

// for authorization button procedure TAutorizationForm.BitBtnAutorizationClick (Sender: TObject); Var i: Integer; s: string; html_tag: Variant; begin html_tag: = WebBrowser.OleObject.Document.Forms.Item (0) .Elements; For i: = 0 To (html_tag.Length-1) Do Begin If (html_tag.item (i) .name = 'here you need to write the name of the field in which you want to enter the user name') Then html_tag.item (i) .value: = 'here we write the user name'; If (html_tag.item (i) .name = 'here you need to write the name of the field in which you want to enter the password') Then html_tag.item (i) .value: = 'write the password here'; If (html_tag.item (i) .value = 'here we write the name of the button to enter') Then html_tag.item (i) .click; End; end;

  • Thanks, login and password Your code enters, only the problem arose with the button, it does not have a name:> <button id = "quick_login_button"> Login </ button> entered this id in the code, but nothing happened. Have something to advise? - Vladimir Archi
  • As for the name of the button, I lied a little: there is not the name but the value property should be used. This code works if the button is formed by the <input> tag. There VKontakte on the site vkontakte.ru/login.php there link button is made. Then, maybe this is how to change the code: <pre> If (html_tag.item (i) .id = 'quick_login_button') Then html_tag.item (i) .click; </ pre> I honestly don’t know how, I always log in to only one site and work there, I had a thought to complicate the program for authorization on several sites, but so far there is no time. - DelphiM0ZG
  • I also tried, only on vkontakte.ru/login.php this button doesn’t even have an id> a href = "javascript: quick_login ()"> Login </a> here’s a zapar ... - Vladimir Archi
  • There the code is generated dynamically and all your attempts with TwebBrouser will not lead to anything - SoftR

I think it is an advantage to use Twebbrouser to work with the Internet. There are many components for sending PostGet requests from Delphi from WinSocks and not loved by the author of the Indy theme to ICS Synapse and there are even ready-made components for authorization on various sites including the VKontakte site.

If you still move away from the belief that Indy does not fit, I will put you a piece of code for authorization on the vkontakte site.

  • I agree. It is as if someone to distill the video in a different format opened it in WMP, captured a picture from the screen, cut off the excess and saved it in the desired format. - Nofate
  • Yes, I would not mind Indy, only the compiler swears at IdGlobal.pas I can’t figure it out, so I’m looking for other methods ... and the error is:> [DCC Fatal Error] IdGlobal.pas (309): F2051 Unit IdStack was compiled with A different version of IdGlobal.TIdPort would be grateful if you could help me with the problem. PS: SoftR, I will be glad to your piece of code - Vladimir Archi
  • To get started, put the latest official version of Indy appropriate for your version of Delphi Because even in the error itself, it is not the version correspondence written. compiled with a different version - SoftR
  • The error tells that the IdStack module was compiled with a different version of the dGlobal.TIdPort class (older or newer than yours). As a rule, this means that you have two different versions of a component in your search paths, or a component is crookedly installed in the system. Normally, a neat and complete reinstallation of the component helps (be sure to check all the paths). - Nofate
  • As it turned out, in the package RAD Studio 2010 + Delphi 2010 Architect, from the Indy components only compiled files (.dcu). I decided to re-install Indi, but I ran into a problem: Indy can only be downloaded using TortoiseSVN, which doesn’t start up on my windows 7 ... Well, I have a second computer, just with windows XP, I downloaded the full package there Indy. Reinstalled - it all worked. It remains to think of what to use to use the program authentication of VKontakte. Thank you all for the advice :) - Vladimir Archi