Forums
This topic is locked
file_get_contents question
Posted 23 May 2006 18:12:26
1
has voted
23 May 2006 18:12:26 David Tregoning posted:
If I use the following code<pre id=code><font face=courier size=2 id=code><?php
$rss_url = "feed.xml";
$rss_feed = file_get_contents($rss_url);
echo $rss_feed
?></font id=code></pre id=code>
I can view the contents of the local feed.xml file, however if I use
<pre id=code><font face=courier size=2 id=code><?php
$rss_url = "news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
$rss_feed = file_get_contents($rss_url);
echo $rss_feed
?></font id=code></pre id=code>
I get the following error
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in c:\Inetpub\wwwroot\php\read_file.php on line 11
Warning: file_get_contents(news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml) [function.file-get-contents]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\php\read_file.php on line 11<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
With line 11 being<pre id=code><font face=courier size=2 id=code>$rss_feed = file_get_contents($rss_url);</font id=code></pre id=code>
Does anybody know why this is?
Many thanks in advance
Replies
Replied 24 May 2006 15:24:39
24 May 2006 15:24:39 Roddy Dairion replied:
Do u have the connection stream for bbc.co.uk ?
Coz they probably have some include files, so if your opening this within your page it will never work. coz the link will be different.
Coz they probably have some include files, so if your opening this within your page it will never work. coz the link will be different.
Replied 24 May 2006 15:48:27
24 May 2006 15:48:27 David Tregoning replied:
I was testing the code on my pc (i.e. localhost/.....)
When I moved the code across to another server it worked fine.
Not sure why, but thanks
When I moved the code across to another server it worked fine.
Not sure why, but thanks
Replied 24 May 2006 16:04:54
24 May 2006 16:04:54 Patrick Woldberg replied:
The code is correct, tested it here and worked.
It should be a configuration setting on your server, check if the allow_url_fopen option is set to "1".
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
It should be a configuration setting on your server, check if the allow_url_fopen option is set to "1".
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
Replied 24 May 2006 16:19:47
24 May 2006 16:19:47 Roddy Dairion replied:
No its not. Mine was On but it still didn't work.