Page 1 of 1

fopen failure

Posted: Thu Jun 26, 2008 12:47 pm
by the_bl_man
Please Help.

I can't seem to write to a file when a URL precedes the file name (see below).
If I remove the URL (i.e., so it just uses "testfile.txt") it works fine.
I have the following parameter set in the php.ini file:
allow_url_fopen = On


$FN = "http://www.myhost.com/testfile.txt";
if (!($fout=fopen($FN,"w"))) die ("Cannot create output file.");

Re: fopen failure

Posted: Fri Jun 27, 2008 4:48 am
by WebbieDave
You won't be able to write to a file through http but it is possible through ftp. From the manual:

Code: Select all

$handle = fopen("ftp://user:password@example.com/somefile.txt", "w");