I have a php script setup which downloads a file from a remote server via
FTP. It worked fine for a couple months until I went to use it one day and
it returned the error below. I hadn't made any changes to the script in that
time. It was no big deal so I wrote it off as it wasn't really an important
script. Today I went to use the "fopen" command in another php script with a
remote http file and it returned the same error. I'm not sure if this is a
php config thing or something else.

Warning: php_network_getaddresses: getaddrinfo failed: No address associated
with hostname

Any help would be greatly appreciated. Thanks!

-Tim

Here is a snippet of the ftp script:
----------------------------------------------------------------------------
-----

$ftp_server="domain.com";
$ftp_user_name="user";
$ftp_user_pass="password
$localfile="/home/usernam/www/filename.txt";
$remotefile="/paht/to/remotfile/filename.txt";
$hostname_softcart = "mysqlhostname";
$database_softcart = "dbasename";
$username_softcart = "user";
$password_softcart = "password
$dbase_name = "dbase";
$file=$PHP_SELF;




// Connect to FTP server
$conn_id = ftp_connect($ftp_server);

// Login with username and password

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// Check Connection
if ((!$conn_id) || (!$login_result)) {
        echo "FTP connection has failed!";
        echo "Attempted to connect to $ftp_server for user $ftp_user_name";
        die;
    } else {
        echo "Step 1:  Connected to $ftp_server Succesfully.<br>";
    }

// Set Passive Transfer Mode.
ftp_pasv($conn_id, pasv);

// Display Download Button
  echo "<form action=$file>";
  echo "<input type=hidden name=download value=true>";
  echo "Step 2: <input type=submit value=\"Click Here to download Database
file\"><br>";
  echo "</form>";

// Download the file
if (isset($download)) {

$download = ftp_get($conn_id, $localfile, $remotefile, FTP_ASCII);

// Check download success...if its OK do some stuff
if (!$download) {
     echo "FTP Download has failed!";
} else {
     echo "STUFF ";
 }
  }

// close the FTP stream
ftp_close($conn_id);

----------------------------------------------------------------------------
-----



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to