Hi,
i am getting error in php file
error is-
Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML’ in C:wampwwwasheeshrs.php:36 Stack trace: #0 C:wampwwwasheeshrs.php(36): SimpleXMLElement->__construct(”, 16384) #1 {main} thrown in C:wampwwwasheeshrs.php on line 36
my code is –
$ch = curl_init(“
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
set_time_limit(120);
$data = curl_exec($ch);
curl_close($ch);
$doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
print_r($doc);
if(isset($doc->channel))
{
parseRSS($doc);
}
if(isset($doc->entry))
{
parseAtom($doc);
}
function parseRSS($xml)
{
echo “<strong>”.$xml->channel->title.”</strong>”;
$cnt = count($xml->channel->item);
for($i=0; $i<$cnt; $i++)
{
$url = $xml->channel->item[$i]->link;
$title = $xml->channel->item[$i]->title;
$desc = $xml->channel->item[$i]->description;
//echo ‘<a href=”‘.$url.'”>’.$title.'</a>’.$desc.”;
echo “<img src=’bullet.gif’ hspace=’0′ vspace=’0′ border=’0′> ”;
echo ‘<font size=2><a href=”‘.$url.'” target=”_blank()”>’.$title.'</a></font><br />’;
}
}
?>
thnks