Access WEB form lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- christensen · 2015-11-26 18:14 Hi, Until this moment i haven't deal with web interfaces, now i want to access a webpage (link) and field some fields (two fields) and submit. How can i write in those fields and execut the submit? What component i sould use. Any help will be appreciate as i never work with network components. Thanks ---------------------------------------------------------------------- SymbolicFrank · 2015-12-04 23:15 Probably Synapse, and especially one called synalist that includes ssl_openssl.pas. But if you want more advice, I would want more details. Like: your platform (Windows x, Linux y, Apple z), what exactly you want to do with that website, and if you are also the person managing that website. ---------------------------------------------------------------------- Leledumbo · 2015-12-06 17:41 You don't really need a component, you need to read and understand how http protocol works. Once you get it, any networking library with http support (including but not limited to the pre-installed fcl-web units) will do. ---------------------------------------------------------------------- Deepaak · 2015-12-06 17:49 If it is your website then it is really very easy to execute this task. Its upto your preference that which library you will like to choose, whether fcl-web, inet, indy or synapse. Add required controls on your form and. Use any of these library to send the forms data to your webpage using the get/post methods. And when you receive that data on your webpage, do what-ever you like, its that simple. ---------------------------------------------------------------------- Remy Lebeau · 2015-12-09 22:37 Quote from: christensen on November 26, 2015, 07:14:47 pmHow can i write in those fields and execut the submit? What component i sould use. If you use Indy, its TIdHTTP component can be used to submit an HTML webform (a
element and fields) to an HTTP server. If the "enctype" attribute is omitted, or set to "application/x-www-form-urlencoded": Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  Http: TIdHTTP;  Input: TStringList;begin  Http := TIdHTTP.Create;  try    Input := TStringList.Create;    try      Input.Add('name=value');    ...      Http.Post('http://server/script', Input);    finally      Form.Free;    end;  finally    Http.Free;  end;end;  If the "enctype" attribute is set to "multipart/form-data": Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  Http: TIdHTTP;  Input: TIdMultipartFormDataStream;begin  Http := TIdHTTP.Create;  try    Input := TIdMultipartFormDataStream.Create;  try      Input.AddFormField('name', 'value');      ...      Http.Post('http://server/script', Input);    finally      Form.Free;  end;  finally    Http.Free;  end;end; ---------------------------------------------------------------------- bee · 2015-12-10 03:32 For simple tasks, using a library is overkill. Web app is very simple, some readln and writeln are enough. I have some examples here: http://beeography.koding.io/viewcode.cgi. No external libraries required, just basic Pascal and some RTL. You could take a look at the source code and you could also run the app. Good luck! ---------------------------------------------------------------------- BeniBela · 2015-12-10 12:48 Or full overkill with my Internet Tools: Code: [Select]query('form((doc("http://server/link")//form)[1], {"name": $_1})', ['value']).retrieve(); and you do not need to care about the enctype, since it checks for that.