cURL is available as a PHP extension that operates as a file request, usually for file operation from external or 3rd party sources that require parameters. While this can be accomplished in-domain within certain limitations using standard php methods (file_get_contents to read non-processed files, or using include and a fully-resolved URL to pass $_GET variables), cURL bypasses these limits.

cURL is available on most shared hosts.

to use cURL, you first call curl_init and pass a single argument – the URL of the file to be requested. A reference to this should be stored for the next steps.

Next, you can set various options with curl_setopt($curl_reference, CURL_OPTION_CONSTANT, $option_value)

You then submit the request using curl_exec($curl_reference), which will return the response retrieved from the URL. Note that you’ll only have the return available from curl_exec if the option of RETURN TRANSFER is set to true (or 1). Otherwise, it’ll output directly. This is usually not desirable because often you’ll want to manage and react to the response, rather than just printing it to the page.

Finally, close it with curl_close($curl_reference)

A simple example might look like this: