fopen failure

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
the_bl_man
Forum Newbie
Posts: 1
Joined: Thu Jun 26, 2008 12:33 pm

fopen failure

Post 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.");
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: fopen failure

Post 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");
Post Reply