Designed for developers, cURL is a command-line utility and library that simplifies data transfer over the web. Most hosting services include cURL, but some make it easier to build an application on cURL.
Before selecting a web host new customers should verify that cURL is enabled or can be installed by the host. Existing Linux server customers can verify that cURL is available by looking for the line, cURL support enabled in the php.ini file. Windows servers automatically include support for cURL.
Later in this post, we do an in-depth discussion on each host. For now, here are the best 5 hosts for cURL:
– Choose from four PHP versions plus SSH access
cURL was originally developed in 1997, with its name being coined the following year. It stands for Client URL Request Library or Curl URL Request Library, and it’s distributed as part of the operating system on a huge range of devices.
What is libcurl?
The project, which also includes libcurl, is lead by Swedish developer Daniel Stenberg and run by a large team of volunteers.
Stenberg started off developing for the Commodore 64 and is now part of the Mozilla project, employed to work on the Firefox browser.
libcurl homepage screenshot via WhoIsHostingThis
How Many People Use cURL?
The team behind cURL says that it’s impossible to say how many people are using their tool.
At the last count, in mid-2012, Stenberg estimated that it’s being used by more than 550 million people.
This figure includes users of Debian, users of iOS devices, people who have purchased certain TVs and DVD players, and players of games like Second Life.
What cURL Does
cURL is a file transfer tool with a simple purpose: to access HTTP content from a PHP script or the command-line.
The former is arguably the more common usage of cURL, since it lets a script pull in content or evaluate the content of another file on the web.
cURL: a Command-Line Tool
cURL command-line screenshot via WhoIsHostingThis
cURL downloads or sends data using a URL. It is a command-line only tool, and its developers clearly state that it will never get a graphical user interface.
If used properly, cURL is a very powerful way to pull data into a PHP script.
cURL vs. wget
If you’ve transferred files using the command-line, you’ve probably come across wget. While wget is designed to transfer large numbers of files, cURL is really good at transferring one at a time.
Note that cURL has no recursive mode, which backs up that statement.
Advanced cURL Features
cURL can also connect to data sources and transfer files using FTP, connect via SSL and send a username and password to gain access to a file that requires a login.
SSL code isn’t built into cURL but requires a compatible library. Support is included for OpenSSL, PolarSSL, axTLS, yassl and more.
How Web Applications Use cURL
The best use case for cURL is grabbing a whole file from a remote server.
Code that handles a file interactively or only needs to examine part of it should use a different approach. Apart from this, cURL is very versatile.
cURL: the File Transfer Swiss Army Knife
The developer will write a callback function which is invoked as the data comes in. It can write the data to a file, forward it to another server, or process it in any way necessary.
Setting up a progress indicator as a file is downloaded is a straightforward programming task.
With appropriate coding, the user of a web application can continue using it for other tasks and get a notification when the file is completely downloaded.
Can I Use cURL to Upload Files?
It’s possible to upload as well as downloading files with cURL, though using it this way is less common.
It can upload by FTP, a POST request, or other ways.
Most servers on the web accept only authenticated uploads, and cURL can handle several authentication methods.
While the cURL application does the actual copying, libcurl is the bundle of instructions that helps it to connect to the data source.
Written in C, libcurl is essentially a protocol library that includes:
SiteGround has good all-around support for custom web applications, including cURL on all its servers. Four different versions of PHP are available along with SSH access.
Many PHP modules are available with the hosting plans, and customers are encouraged to ask if they need others. Even inexpensive plans include these features. With 24/7 support, a 99.9% uptime guarantee, and international datacenters, it’s well suited to hosting highly customized websites.
A2 Hosting supports command-line cURL as well as including cURL in its PHP support. This includes all the versions of PHP5 and PHP7 which it offers. Customers can quickly switch between PHP versions as needed.
In addition to making it available in its standard plans, it offers extra speed on its Turbo servers, with all the features. Around-the-clock support, datacenters in three countries, and 99.9% uptime add to its attractions.
cURL is a completely free software project consisting of libcurl — a C-based client-side URL transfer library, and curl — a command line tool for transferring files using URL syntax.
A similar tool is Wget. It is able to recursively download a large number of files, cURL is made to do a single-shot transfer of data. cURL offers uploading and sending capabilities, while Wget only offers plain HTTP POST support. Also, cURL builds and runs on lots more platforms then Wget.
What exactly is cURL used for?
The most common use of cURL is to access HTTP content from a PHP script or command line. It enables a script to use the contents of another file on the web.
One example would be a C program that uses the cURL library to send data to a PHP script on a web server, where the script then stores the data in a MySQL database.
Which transfer protocols does cURL support?
cURL supports the following transfer protocols: DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. Libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, HTTP proxy tunneling and more.
How can I use cURL in my favorite programming language?
Numerous interfaces are available for more than 40 languages, including: Ada95, Basic, C, C++, Ch, Cocoa, D, Dylan, Eiffel, Euphoria, Ferite, Gambas, glib/GTK+, Haskell, ILE/RPG, Java, Lisp, Lua, Mono, .NET, Object-Pascal, O’Caml, Pascal, Perl, PHP, PostgreSQL, Python, R, Rexx, Ruby, Scheme, S-Lang, Smalltalk, SP-Forth, SPL, Tcl, Visual Basic, Visual FoxPro, Q, wxwidgets and XBLite and more. There are also custom bindings to the libcurl library made by other projects and people, outside of the cURL project.
What about platform support for cURL?
cURL is highly portable, it builds and works on many different platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, and DOS.
What are the hosting requirements for cURL?
On Windows hosting, cURL is automatically installed with the WAMP software stack. Linux hosting installs cURL in two parts, as a module within Apache and an extension for PHP. Most hosting providers today already have cURL installed on their servers. If not, your host should be able to install cURL quickly.
Can You limit cURL bandwidth usage?
Yes, cURL allows you to limit the transfer rate. You can specify the maximum transfer rate for cURL which is useful if you do not want your transfers to use up your entire bandwidth allocation. The specified limit affects both downloads and uploads from cURL.
Are there any compatibility issues I should be aware of?
Not really, at least not with the latest version of cURL. There was an issue with PayPal when it discontinued support for SSL 3.0 in December 2014, but that was only the case with outdated version of cURL.
Are ASP, XML, or XHTML supported by cURL?
Yes, they are all supported, it does not matter how the page was generated. cURL does not even know which language or technology is used to generate a page.
What are the most common hosting problems associated with cURL?
If you simply try to access an HTTPS resource (SSL or TLS-protected resource) in PHP using cURL, you’re likely to run into some difficulties. The problem is that cURL has not been configured to trust the server’s HTTPS certificate, and by default, cURL is set-up to not trust any certification authorities (CA).
There are two ways around this problem. First, you can simply configure cURL to accept any server (peer) certificate. This isn’t optimal from a security point of view, but if you’re not passing sensitive information back and forth, this is probably okay. The second option involves setting the CURLOPT_CAINFO parameter. This is used to point towards a CA certificate that cURL should trust.
Is cURL free? Will it add to my hosting bill?
Both cURL and libcurl are open-source and are published under the MIT/X derivate license. It means that you are free to modify and redistribute all contents of cURL distributed archives. You may also freely use cURL and libcurl in your commercial projects. Using cURL should not cause any additional hosting costs.
What about Keep-Alive or persistent connections?
cURL and libcurl both support persistent connections while transferring multiple files from the same server. cURL will attempt to reuse the connection for all URLs specified in the command.
I am concerned about security. Will using cURL cause security issues?
No, cURL is configured by default to use secure requests over SSL/TLS. Configuring the location of an up-to-date, trusted certificate bundle is essential in keeping cURL transfers safe.
How important are cURL updates?
Like all vital software components, it is always a good idea to choose a host that offers timely updates. In this respect, cURL is no exception.
Gary McGath spent years as a software developer before turning to writing. In addition to writing many articles on technology, he's the author of two crowdfunded e-books. His tech passions include data security and digital preservation.