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;

Feedback

Add Feedback
how can i send request with some custome header for SOAP?
thanks.
mora

Daniel Simanullang (November 13, 2018 at 11:25 AM)
You need to use the following code:

clHttpRequest1.Header.ExtraFields.Add('custom-header: a value follows here');

Sergey Shirokov (November 15, 2019 at 12:06 PM)

Add Feedback