FreeHostia Forums
https://forum.freehostia.com/

trouble opening xml with simplexml_load_file.
https://forum.freehostia.com/viewtopic.php?f=7&t=12345
Page 1 of 1

Author:  lordraz [ Thu Jan 21, 2010 1:19 am ]
Post subject:  trouble opening xml with simplexml_load_file.

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....

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/