fwrite to FTP

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
Vladinator
Forum Newbie
Posts: 12
Joined: Mon Feb 28, 2005 6:08 pm

fwrite to FTP

Post by Vladinator »

My problem is that when I run the script...

Code: Select all

$file = fopen(&quote;ftp://username:password@swede-wow.kicks-ass.org/somefile.txt&quote;,&quote;w&quote;); 
fwrite ($file, $text); 
fclose ($file);
... I get the error...

Code: Select all

fopen(): URL file-access is disabled in the server configuration
I tried to add this line, in the php script file:
ini_set('allow_url_fopen', 1);

...But the same error, still comes. Any ideas? :?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Please read the posting code guidelines linked to in all posting pages and in my signature.

allow_url_fopen is a system level setting. That means it can only be changed in httpd.conf or php.ini.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

use php to connect to the ftp instead of the url.
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
Post Reply