cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > libcurl > libcurl Pascal Binding

CurlPas -- accessing libcurl from Pascal

CurlPas is a FreePascal - Lazarus - Delphi - Kylix - compatible binding and object-oriented wrapper for libcurl.

Libcurl is a web-client library that can provide cross-platform Pascal applications with an easy way to implement such things as:

  • Download files using FTP or HTTP.
  • Upload files using FTP,  HTTP PUT and multipart/form-data (aka rfc1867).
  • Perform multiple concurrent transfers using the curl_multi interface.
  • Resume partial file transfers.
  • Timeout settings for connect, minimum transfer speed, and total download time.
  • Username:password authentication to remote and/or proxy servers.
  • SSL/TLS connections using the OpenSSL or GnuTLS libraries.
  • Retrieve resource information such as HTTP HEAD or FTP LIST.
  • Send and receive cookies ( from a NS cookie file, or input/output strings ).
  • Send "spoofed" headers such as User-Agent and Referer.
  • Set additional custom HTTP headers as required.
  • Support for remote FTP commands like MKDIR, DEL, and CHMOD.
  • Generate "human-readable" error output and/or logs on failed transfers.
  • And much more...

CurlPas also includes the tCurl and tCurlMulti components, to provide an easy to use "wrapper" around libcurl.
( This provides simple get/set properties for libcurl's options and information functions, event-based hooks to
libcurl's I/O, status, and progress callbacks, and wraps the c-style file I/O behind simple filename properties. )

Documentation

All details on CurlPas is found on the CurlPas web page: curlpas.sourceforge.net.

Examples
A simple http download program...

  program simple;
  {$APPTYPE CONSOLE}
  uses curlobj;
  var 
    Curl: TCurl;
  begin
    Curl := TCurl.Create(nil);
    Curl.URL := 'http://curl.haxx.se/';
    Curl.OutputFile := 'curl.html';
    if not Curl.Perform then
      WriteLn(Curl.ErrorString);
    Curl.Free;
  end.
( Several more complex examples are included with the CurlPas sources. )

Binding documentation
Documentation for the component wrapper can be found in the source package,
and on the CurlPas website.

The core pascal bindings are quite similar to their C-language equivalents,
read the libcurl documentation for information, in particular:

  • man libcurl
  • man curl_easy_setopt
  • man curl_easy_getinfo

Credits
Written by Jeffrey Pohlmeyer.

What is Pascal?
You'll find more info Free Pascal here: http://www.freepascal.org.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET