[fpc-pascal] RE: Download file

Jeff Pohlmeyer yetanothergeek at gmail.com
Fri Nov 18 16:36:49 CET 2005


> I would like to download a file via HTTP, how can I achieve that in a
> platform independent way? What components to use and is there 
> some code suited for dummy's available.


If you don't mind using an external DLL, CurlPas is quite simple,
and works on Linux, Windows, and possibly even Mac...

========================
program simple;
uses curl_obj;
var
  Curl:TCurl;
begin
  Curl:=TCurl.Create(nil);
  Curl.URL:='http://www.freepascal.org/index.html';
  Curl.OutputFile:='fpc.htm';
  if ( not Curl.Perform ) then WriteLn(Curl.ErrorString);
  Curl.Free;
end;
=====================

And that's all there is to it! The library can automatically
follow any redirects, deal with cookies, handle https and ftp 
downloads, etc, etc, etc...

For more info, see:
  http://curlpas.sourceforge.net/
  http://curl.haxx.se/libcurl/


 - Jeff




More information about the fpc-pascal mailing list