sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
After installing cURL you have to restart Apache using the below given command
sudo /etc/init.d/apache2 restart
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
After installing cURL you have to restart Apache using the below given command
sudo /etc/init.d/apache2 restart
Example :
<?php
$url = “www.example.com”; // Desired URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$returned = curl_exec($ch);
curl_close ($ch);
echo $returned;
?>
<?php
$connect = curl_init("http://www.unixsite.com/feed/rss/");
curl_setopt($connect, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connect, CURLOPT_HEADER, 0) ;
$result = curl_exec($connect);
curl_close($connect);
$data = new SimpleXmlElement($result, LIBXML_NOCDATA);
for($i=0;$i<10;++$i) {
if(empty($data->channel->item[$i]->title)) break;
echo $data->channel->item[$i]->title;
echo $data->channel->item[$i]->description;
}
?>