get XML from outside server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pc-moon
Forum Newbie
Posts: 3
Joined: Tue Apr 26, 2011 7:02 pm

get XML from outside server

Post by pc-moon »

hello

hope all is well

i use php5

my code :

Code: Select all

	$xml = simplexml_load_file('http://feeds.bbci.co.uk/news/rss.xml?edition=int') ;
	
	 foreach($xml->channel->item as $key110 ){echo "<a href='".$key110->link."'><h3>".$key110->title."</h3></a><br>".$key110->description."<br>".$key110->pubDate."<hr>";}

also it's work on my computer
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: get XML from outside server

Post by pickle »

Did you have a question?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
pc-moon
Forum Newbie
Posts: 3
Joined: Tue Apr 26, 2011 7:02 pm

Re: get XML from outside server

Post by pc-moon »

yea i wanna ask

this code work well on my computer , but not work on host or server

i mean code get data from xml file of xml formate in localhost --> my computer

but not work on my web site , it's mean didn't read from another server

thank u
eivind
Forum Commoner
Posts: 28
Joined: Tue Apr 19, 2011 7:57 am

Re: get XML from outside server

Post by eivind »

Maybe your web host does not allow loading files outside of the web host?
pc-moon
Forum Newbie
Posts: 3
Joined: Tue Apr 26, 2011 7:02 pm

Re: get XML from outside server

Post by pc-moon »

thank u so much

okey if server not allow what message is send , cause i don't know what is called to get data from another server

also i think my code need some code also , but i'm tiered , i tested curl but no resault

thank u again
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: get XML from outside server

Post by McInfo »

The ability of simplexml_load_file() and other functions to load remote content is affected by allow_url_fopen.
Post Reply