1

I've been trying to solve this but can't find the solution, I am trying to get the contents of file from my FTP server via PHP.

$conn_id = ftp_connect("ftp.testftp.co.uk");
$ftpuser="myusername";
$ftppassword="mypassword";
$login_result = ftp_login($conn_id, $ftpuser, $ftppassword);

if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
exit;
} else {
echo "Connected To FTP";
echo  nl2br ("\n");
}

$data = file_get_contents('ftp://myusername:mypassword@ftp.testftp.co.uk/test.tsv');

I get can connected to the FTP ok but can't read the file, I get the error "failed to open stream: operation failed", im not sure what I am doing wrong, any advice would be appreciated.

Thanks

Scott Brown
  • 73
  • 1
  • 7

0 Answers0