I'm trying to make a script that will transfer files to a remote server via ftp. It seems to work when targetting the server the script is on, but I can't for the life of me create a connection to any other ftp server (it fails to even create the stream, so it's not a username/password issue).
Here's my code:
Code: Select all
<?php
$port= $_GET['port'];
$host = $_GET['host'];
$username=$_GET['user'];
$password=$_GET['pass'];
// do ftp stuff
$connection = ftp_connect($host,$port);
$login = ftp_login($connection, $username, $password);
if (!$connection || !$login) {
die('Connection attempt failed!');
} else{
echo 'Connection success';
}
ftp_close($connection);
?>The error message I get is: Warning: ftp_login() expects parameter 1 to be resource, boolean given
I'm very new to php so I'm at a loss, hoping someone can shed some light!!
thanks,
JMC