curl is used to communicate using different protocols including HTTP POST, HTTP PUT, FTP and many more.
curl, however, is not installed on default when you install PHP. You will need to install the module.
To install curl for PHP in Ubuntu, you will need to use Debians
sudo apt-get install php5-curl
You should use
sudo in case anything needs sudo access.
A standard install will follow:
Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'libcurl4-openssl-dev' instead of 'libcurl3-dev' curl is already the newest version. libcurl3 is already the newest version. libcurl4-openssl-dev is already the newest version. The following packages were automatically installed and are no longer required: libcap2 apache2-mpm-prefork Use 'apt-get autoremove' to remove them. The following NEW packages will be installed: php5-curl 0 upgraded, 1 newly installed, 0 to remove and 100 not upgraded. Need to get 33.2 kB of archives. After this operation, 138 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://ppa.launchpad.net/ondrej/php5/ubuntu/ precise/main php5-curl amd64 5.5.9+dfsg-1+sury.org~precise+1 [33.2 kB] Fetched 33.2 kB in 0s (93.6 kB/s) Selecting previously unselected package php5-curl. (Reading database ... 101351 files and directories currently installed.) Unpacking php5-curl (from .../php5-curl_5.5.9+dfsg-1+sury.org~precise+1_amd64.deb) ... Processing triggers for libapache2-mod-php5 ... Setting up php5-curl (5.5.9+dfsg-1+sury.org~precise+1) ... locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory php5_invoke: Enable module curl for apache2 SAPI php5_invoke: Enable module curl for cli SAPI Processing triggers for libapache2-mod-php5 ...
You may or may not need to restart apache. I make a habit of restarting my server when I make non-application changes.
sudo service apache2 restart
You can now use PHP curl functions. Please refer to the curl documentation for further information.