mworkman Posted November 15, 2010 Share Posted November 15, 2010 I am trying to load an xml file but I can't seem to find the location to load it. Here is the location of the xml file: C:\inetpub\wwwroot\php\webphp.xml Here is the location of the file trying to load the xml: C:\inetpub\wwwroot\php\gui\guiindex.php What location would I put in here: $xml = new SimpleXMLElement("XMLFILELOCATION", NULL, true); Quote Link to comment Share on other sites More sharing options...
simshaun Posted November 15, 2010 Share Posted November 15, 2010 Have you tried C:\inetpub\wwwroot\php\webphp.xml? If so, did you escape the backslashes (assuming you surrounded the string with double-quotes?) Alternatively, ../webphp.xml Quote Link to comment Share on other sites More sharing options...
rwwd Posted November 15, 2010 Share Posted November 15, 2010 well firstly you need to define the absolute file path, and have that done in the root file, something like this:- define('ABSOLUTE_PATH', dirname(__FILE__). "/"); This will give you the complete server path for you to work with defined within a constant - and a trailing slash, then you can refer to this in the xml function - this should help you out with this issue, but seriously, always use absolute paths, then you can avoid the toothpick syndrome, and this will make your code easier to maintain. Rw Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.