It is currently Thu Mar 28, 2024 7:12 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: trouble opening xml with simplexml_load_file.
PostPosted: Thu Jan 21, 2010 1:19 am 
Newbie
Newbie

Joined: Fri Jan 30, 2009 6:14 am
Posts: 3
Location: United States
I'm writing a website for a school team, and the team members wanted to have custom built blogs, so I obliged. Now I'm scripting the RSS feeds so it can be linked to the teams facebook page. However, I'm running into some trouble opening my xml feed file (feed.xml) where the feed is housed.
Here's what I'm doing:
$rssname corresponds to the file feed.xml and its proper path.
Essentially, when one of the team members posts a new blog entry, I'm adding a new <item> child to the feed.xml file, which, if I'm not mistaken will then be read by facebook and posted as a new note on the teams fan page.
Code:
$feed = simplexml_load_file($rssname) or die("failed loading xml");
$feedsource = new SimpleXMLElement($feed->asXML()) or die("failed converting file to xml");
$update = $feedsource->addChild("item") or die("failed adding child item");
$update->addChild("title",$title) or die ("failed adding title child item");
$update->addChild("link","http://paschalcs.freehostia.com/blogs.php?name=$name&page=1")or die("failed adding link child");
$update->addChild("description",$entry) or die("failed adding description child");
$feedsource->asXML($rssfile) or die("failed converting back to xml file");


I was running into trouble getting the page to work correctly so I added the rather silly looking die tags just to help myself debug. my php page is dying with the
Code:
$feed=simplexml_load_file($rssname)
part, so I'm not sure if the rest will work or not. I read that some times hosting websites like this one disable some of php's xml functions as a security measure and was wondering if this was the case here.

Any help would be appreciated.

Thank you.

EDIT: I've recently learned that this code wont work regardless of whether load_file does, but thats ok. I still need to figure out how to get load_file working. as it isn't....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011