PHP/CURL is a binding that uses libcurl. It means that the PHP team has written a glue layer for PHP that speaks to the underlying libcurl. That layer, the binding, is what we call PHP/CURL and that is what offers the functions named curl_* within the PHP language for you. The PHP/CURL binding is written, maintained and being provided by the PHP team and you will not find any binaries, DLLs or other packages for it on this site.
You can download cURL by going to the cURL website and download the zip file of cURL dlls. Once you have the dlls you are able to install these on your apache web server.
On windows apache server it’s easy to install PHP extensions simply move the extensions into the php/ext folder on the server. Open the php.ini file and add the following to the extension area extension=php_curl.dll
Examples Of Using cURL
To use cURL in PHP use the following example code
$request = "request=string of request"; // Send using curl $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url); // URL to post curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_PORT, 8080); curl_setopt($ch, CURLOPT_POSTFIELDS,$request); $result = curl_exec( $ch ); // runs the post //perform tasks on $result curl_close($ch);
The best use of the cURL is to be used to get data from other domains, which can be used to get your social media followers, get the amount of times an article is shared etc.
Here are a couple more examples of what you can do with cURL.