Hi ,
I am using php script for displaying rss feed .. But i am getting following errors while i compile the program...
Warning: simplexml_load_file() [function.simplexml-load-file]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Apache\Apache2\htdocs\phpProjects\rss.php on line 27
Warning: simplexml_load_file(http://rss.news.yahoo.com/rss/topstories) [function.simplexml-load-file]: failed to open stream: No such file or directory in C:\Apache\Apache2\htdocs\phpProjects\rss.php on line 27
Warning: No such file or directoryI/O warning : failed to load external entity "http://rss.news.yahoo.com/rss/topstories" in C:\Apache\Apache2\htdocs\phpProjects\rss.php on line 27
yahoo!news
My php code for it is *********
<html>
<style type="text/css">
body { background-image: url("http://www.grsites.com/textures/misc/misc142.jpg"); font-family:Arial; font-size:18px; color:darkred; } ; </style>
<?php
$handle=mysql_connect("172.17.16.73", "root", "abc123") or die ("cant connect");
mysql_select_db("tutorial",$handle) or die ("cant change");
// open database file
// generate and execute query
$query = "SELECT id, title, url, count FROM rss";
$result = mysql_query($query,$handle) or die ("cant connect");
// if records present
if (mysql_num_rows($result) > 0) {
// iterate through resultset
// fetch and parse feed
while($row = mysql_fetch_object($result)) {
$xml = simplexml_load_file('http://rss.news.yahoo.com/rss/topstories');
echo "<h4>$row->title</h4>";
for ($x = 0; $x < $row->count; $x++) {
if (isset($xml->channel->item)) {
$item = $xml->channel->item[$x];
}
echo "<a href=\"$item->link\">$item->title</a><br />$item->description<p />";
}
echo "<hr />";
// reset variables
unset($xml);
unset($item);
}
}
// if no records present
// display message
else {
?>
<font size = '-1'>No feeds currently configured</font>
<?php
}
// close connection
mysql_close($handle);
?>
</body>
</html>
Do could u suggest me sort out these bugs!!!
I have internet connection and using php5
Thanks in advance..
Regards
mayank