curl4delphi is a simple Delphi XE2+ binding for libcURL.
© 2015–2017 Mikhail Merkuryev
My initial version supports “easy” interface only.
Version 0.3 “Tokyo” is out! It is much easier than 0.2.
Check it now, though you can face some incompatibilities with older versions. But I think they are easy to overcome, nothing was changed radically.
- Add files
Curl.Lib
,Curl.Easy
,Curl.Interfaces
to your project. - Write such a piece of code.
var
curl : ICurl;
curl := CurlGet;
curl.SetUrl('http://example.com')
.SetProxyFromIe
.SetUserAgent(ChromeUserAgent)
.SwitchRecvToString
.Perform;
Writeln(curl.ResponseBody);
[To use streams for receiving, check EasyHttp\StreamedDl
].
Shows version
Basic HTTP GET, same as written above.
Redirection, basic HTTP GET, GetInfo
Redirection, basic HTTPS support, CA files, Unicode in file names.
Warning: download a CA file such as cacert.pem.
Downloading to Delphi TStream’s.
A GUI file downloader. This example is rather complex because of multithreading and Content-Disposition
. We do as most browsers do: request headers, then start writing to temporary file and simultaneously ask where to save it on HDD.
Inter-thread communication, transfer function, quick-and-dirty header parsing.
A simple form demo. Please copy php_curl
directory to a PHP-capable web server.
Forms (one field is set in a simple way, the other in more complex one).
File uploading: disk file (2 ways), memory buffer, stream.
ICurl cloning demo (not particularly good, it is more an illustration that Clone works).
Please copy php_curl
directory to a PHP-capable web server.
Using ICurlGetBuilder to build a GET URL. Please copy php_curl
directory to a PHP-capable web server.
MIT for library, public domain for examples.