Click to See Complete Forum and Search --> : Retrieve contents from a webpage/xml file


joca
12-21-2004, 06:54 AM
Hi,

I am trying to make a php page that open a RSS (XML) file from, for example the BBC homepage. I want to show the news content on my page. In my code I use fopen(..url) to open the file, and it works if the file is located on my domainaccount. If the file is on another domain ie BBC I get an error.

I guess that the host has blocked fopen so I wonder if there are any other way of retrieving the contents of a file on an remote domain?

I have also tried file_get_contents..... without success....

Best regards

JoCa

96turnerri
12-21-2004, 02:47 PM
when you say
If the file is on another domain ie BBC I get an error.

but you said in your first example about BBC, not sure what you mean, you host may have disabled fopen for URLs try this at top of code

ini_set(allow_url_fopen, "1");

shimon
12-22-2004, 09:45 AM
But remember that allow_url_fopen can only be set at a system level, i.e. in php.ini or httpd.conf - so adding that line to your code will have no effect, unfortunately.

96turnerri
12-22-2004, 10:12 AM
i thought it was all but you are right its system, so sorry that method will not work

joca
12-23-2004, 04:05 AM
Thanks for the help,

Are there any other ways to get hold of the contents on a webpage, I am trying to read an xml file on the web? For example:

http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml

Thanks in advance,

Merry Christmas to you all

JoCa

96turnerri
12-23-2004, 12:31 PM
http://uk.php.net/manual/en/function.xml-parse.php