Duffman12
11-02-2006, 05:53 AM
so i'm using fopen to read some xml generated by a php.
$fp = fopen("http://www.site.com/path/xml_generator.php","r");
i really dislike absolute paths... so i tried:
$fp = fopen("xml_generator.php","r");
the problem with that is that is that it's reading the actual php, not what the php generates.
my idea for a solution to this was to use the $_SESSION variables to construct the path of the url, then i can use ../ and such as needed. Something like "$path_to_dir/xml_generator.php" However, this method is not very graceful, as I would have to regex some of the path.
does anyone have any other ideas? or is there an easier way to dynamically get the path of the file? (http://www.site.com/path/)
$fp = fopen("http://www.site.com/path/xml_generator.php","r");
i really dislike absolute paths... so i tried:
$fp = fopen("xml_generator.php","r");
the problem with that is that is that it's reading the actual php, not what the php generates.
my idea for a solution to this was to use the $_SESSION variables to construct the path of the url, then i can use ../ and such as needed. Something like "$path_to_dir/xml_generator.php" However, this method is not very graceful, as I would have to regex some of the path.
does anyone have any other ideas? or is there an easier way to dynamically get the path of the file? (http://www.site.com/path/)