But before that let me explain what cURL is for the benefit of the uninitiated (i was one of which, just a couple of months back!), cURL is a command line tool for transferring files with URL syntax. It supports a number of transfer protocols including HTTP and FTP. One of the most important usage of cURL (and the one that we are concerned with) is that you don’t have to depend upon the browser to retrieve the web pages, cURL can retrieve it for you but it would return the raw source and in a terminal window which may not be of much use to a non-technical user but it is a great tool for developers especially at a time when a lot of web services exist that do not cater to the average user but are consumed by other programs over the network. Another factor that increases the importance of cURL is the popularity of services based on REST protocol. Infact all major players on Web includingGoogle, Amazon, Facebook, Twitter and Ebay to name a few, have already implemented REST API on their respective sites.
You can try out cURL command line tool by downloading it from here
To see how it works, all that you would need to do is go to the command line and into the specific directory and type cURL -[options] URL where URL is the web resource you want to download and the option parameter is specified to perform the particular operation. All functionalities that cURL offers are available through its option parameter, to find out more on how to use options click here
The steps described above give you an overview of what cURL is and what it does, to use it programmatically we would require supporting libraries. Thankfully, XAMPP installs the cURL library during its installation but it is not enabled by default, you have to manually enable it.
However, it is easy, go to the XAMPP folder and open the php.ini file from the path ../apache/bin/php.ini ( Do note, that there is more than one php.ini file in XAMPP installation but the particular file that needs to be changed resides in ../apache/bin/php.ini).
Open the .ini file in notepad, search for the string “;extension=php_curl.dll“. Remove the semi-colon and save the file. Restart apache.
CURL library should work fine now, create a test page with the following code and run it just to make sure that it is now working