Jump to content


Photo

url open help


  • Please log in to reply
3 replies to this topic

#1 vmlsd

vmlsd
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 May 2006 - 10:07 AM

i was trying to run the following code

<html>
<body>
<?php
$xml = simplexml_load_file('http://rss.news.yaho.../rss/topstories');
if (isset($xml->channel->item)) {
foreach ( $xml->channel->item as $key=>$item ) {
echo "<a href=\"{$item->link}\">{$item->title}</a><br />";
echo "{$item->description}<br /><hr />";
}
}
?>
</body>
</html>

but the errors display eventhough i set allow_url_open = on


Warning: simplexml_load_file() [function.simplexml-load-file]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\http\index.php on line 4

Warning: simplexml_load_file(http://rss.news.yaho.../rss/topstories) [function.simplexml-load-file]: failed to open stream: No such file or directory in C:\http\index.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://rss.news.yaho...rss/topstories" in C:\http\index.php on line 4


thank you

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 May 2006 - 03:42 PM

That's probably because you're not specifying a specific file. You're just giving it an address. Could it possibly be: $xml = simplexml_load_file('http://rss.news.yaho.../topstories.xml'); ?

Info: PHP Manual


#3 vmlsd

vmlsd
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 May 2006 - 09:36 AM

[!--quoteo(post=376062:date=May 22 2006, 10:42 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 22 2006, 10:42 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
That's probably because you're not specifying a specific file. You're just giving it an address. Could it possibly be: $xml = simplexml_load_file('http://rss.news.yahoo.com/rss/topstories.xml'); ?
[/quote]

i have got the answers from other forums and they say it is not because of the code. it might be because
of firewall or php setting something like that. but i havent got a solution. do you have any clue about this. thank you

#4 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 23 May 2006 - 01:26 PM

php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\http\index.php on line 4

This error is most likely referring to DNS issues. You can try restarting APACHE while connected to the net, if you weren't connected when you first started it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users