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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s