note 10875 deleted from function.fopen by sander
| From: | sander@php.net | Date: | Sun, 07 Apr 2002 11:12:14 +0000 |
| Subject: | note 10875 deleted from function.fopen by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28823@lists.php.net to get a copy of this message | ||
Fopen does not handle redirects, this means that if you are running a virtual domain, you will need
the full path from the root (ie: /home/users/me/web/file.txt), instead of the URL (ie: http://www.myvirtualdomain.com/file.txt)
If you don't know the path of the file from the root, run a fopen against a file that
doesn't exist from the same dir of the file you want to open:
// Open file for writing
if(!($outFile=fopen('http://www.yourvirtualdomain.com/inexistentfile.txt,'a')))
{
echo "Could not open the file.";
exit;
}
This will throw an error with the path from the root for your php file containing the above code.
Use this path for your file like this:
// Open file for writing
if(!($outFile=fopen('/home/users/me/web/file.txt,'a')))
{
echo "Could not open the file.";
exit;
}
Murdock