How to download files from internet using free pascal/Lazarus

You can download any files from Internet using Synapse THTTPSend class .

After downloading Synapse library, put it’s source library path into your current project options (Compiler Options/ Other unit libraries), and add httpSend in your application uses Clause, and write this code to download a file from Internet:


procedure TfmMain.btDownloadClick(Sender: TObject);
var
  httpClient: THTTPSend;
begin
  httpClient:= THTTPSend.Create;
  if httpClient.HTTPMethod('GET', 'http://code.sd/turbobird/main.jpg') then
    httpClient.Document.SaveToFile('main.jpg');
  httpClient.Free;
end;

One thought on “How to download files from internet using free pascal/Lazarus

  1. Pingback: Synapas http Download from internet using threads in Free Pascal « Free Pascal Answers

Leave a comment