Home Guides Glossary

What is CURL?

CURL = Client URL Library

cURL is supported on almost all hosting accounts (more info). Most may be wondering "what exactly is CURL" and the aim of this document is to give a brief overview on what CURL is and (hopefully) provide enough of an understanding of CURL so that when a question arises you can provide enough information to guide the customer in the correct direction.

What is CURL?
According to Daniel Stenberg (the creator of the libcurl library) CURL is a library "...that allows you to connect and communicate to many different types of servers with many different types of protocols."

In other words, CURL is a browser for scripting languages (such as PHP) or server functions. Those who are familiar with the *NIX application LYNX may be right at home with CURL's features.

What does CURL allow me to do?
At the time of this writing CURL currently supports connections to remote systems over http, https, gopher, telnet, dict, file, and ldap protocols allowing a script to access information from a remote system as if it were a local file / data stream.

This is important for developers who would like to acquire information from a remote system and present it as if they had the data locally.

How would I use CURL?
The idea behind CURL is that a CURL session is first opened then options are passed though the open session then once finished the CURL session is closed. Below is a PHP example script that will create a CURL session, obtain a file, and include the transport headers from the transfer, and finally write the file to a local file.

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);


For a rough breakdown of the CURL components from the above PHP script see below.

First the CURL Session is established.
$ch = curl_init("http://www.example.com/");
// Have CURL connect to www.example.com via http

Set the options for CURL to follow
curl_setopt($ch, CURLOPT_FILE, $fp);
// With the information that is received, write it to a local file.
// as Defined by $fp = fopen("example_homepage.txt", "w");
curl_setopt($ch, CURLOPT_HEADER, 0);
// Include the transport headers in the data received

Finally, execute the session and close it.
// curl_exec will execute the entire CURL session commands
// curl_close terminates the CURL session
// fclose simply closes the local file which is the output from the CURL session

Where should I go to obtain further information about CURL?
Two Websites would be the best to go to for information on CURL's use and functions.

Customers wishing to use CURL should be directed to those Websites for coding examples. At the time of this writing all CURL extensions are enabled for use (basic PHP restrictions still apply, but the session options are available).

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

For as little as $3.89 per month you can build your Website online with Website Builder using our easy to use professional templates. Play Video - Demo

Quick Shopping Cart

Build and run your own successful online store in minutes. You're just five easy steps away! Shopping Cart works with Google® and eBay® Play Video

Website Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate

Copyright © 2005 - 2019. All rights reserved. Privacy Policy