Sending a GET Form request

 
Sending a GET Form request with TclHttp
 
procedure TForm1.Button2Click(Sender: TObject);
var
  response: TStrings;
begin
  //Composing a new request.
  clHttpRequest1.Clear();

  clHttpRequest1.AddFormField('name', 'John');
  clHttpRequest1.AddFormField('account', '12345');

  response := TStringList.Create();
  try
    //Request data will be sent as a Query String of URL.
    clHttp1.Get('https://example.com/account.asp', clHttpRequest1, response);
  finally
    response.Free();
  end;
end;
 
Sending a GET Form request with TclDownloader
 
procedure TForm1.Button3Click(Sender: TObject);
begin
  //Composing a new request.
  clHttpRequest1.Clear();

  clHttpRequest1.AddFormField('name', 'John');
  clHttpRequest1.AddFormField('account', '12345');

  //Configuring Downloader to send request data as a Query String of URL.
  clDownloader1.URL := 'https://example.com/account.asp';
  clDownloader1.LocalFile := 'response.htm';
  clDownloader1.HTTPRequest := clHttpRequest1;
  clDownloader1.UseHTTPRequest := True;

  //Start the process synchronously.
  clDownloader1.Start(False);
end;

Add Feedback