Amateur php user trying????

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
richardk
Forum Newbie
Posts: 4
Joined: Thu Jun 05, 2008 11:07 pm

Amateur php user trying????

Post by richardk »

I am trying to use the script below:

<?php
$file = fopen ("ftp://xxxxx:xxxxxxxx@ftp.xxxxxxxxxxxxxxxx.com/close.txt", "a");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
/* Write the data here. */
fwrite ($file, $_SERVER['HTTP_USER_AGENT'] . "\n");
fclose ($file);
?>

to simply create a file on a remote machine. A script, on the remote computer, will detect the file and tend to the needed actions, then delete the file in preparation for the next time it is needed .

The problem I am having at the moment is this:

I have an Apache web server on my local machine, and from here the script does as expected, it opens the file on the remote machine using ftp.

We have our website hosted in two locations, one here on site, using an Apache web server on a Debian machine, and when I try to run the script on that machine it gives the following error:

Warning: fopen(ftp://...@ftp.xxxxxxxxxxxxxxxx.com/close.txt): failed to open stream: FTP does not support simultaneous read/write connections. in /home/content/n/m/s/xxxxxxx/html/openremotefile.php on line 13

Unable to open remote file.

We also host our site, at this time just as a backup, but will soon be full time, at Godaddy, and when I run the script on that site I get the same error:

Warning: fopen(ftp://...@ftp.xxxxxxxxxxxxxxxx.com/close.txt): failed to open stream: FTP does not support simultaneous read/write connections. in /home/content/n/m/s/xxxxxxx/html/openremotefile.php on line 13

Unable to open remote file.

I know to little about php to know why this generic script is acting this way. What I want to do from here, once it works correctly, is add a button to the page (which I will figure out how to do once this is correct) to initiate this script to write the file to take the action needed.
Post Reply