This is a short example to illustrate the use of Curl.
Note: You should make sure that the extension php5-curl is installed. If not, open a terminal, type:
sudo apt-get install php5-curl
<?php
/**
* A simple example that gets an HTTP page.
*/
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.msn.com/');
curl_setopt ($ch, CURLOPT_HEADER, 0);
$data = curl_exec ($ch);
curl_close ($ch);
if (!$data)
{
die(sprintf('Error [%d]: %s', curl_errno($ch), curl_error($ch)));
}
else
{
echo $data;
}
?>