I am having problems with this, and I am not sure why.

I put in this FTP address into my browser:
[url]ftp://productads.amazon-digital-ftp.com/[/url]

I get prompted for login/pass, I want to get this far in a PHP script, so I try this:

<?php
$ftp_server = "productads.amazon-digital-ftp.com";
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
ftp_close($conn_id);
?>

This script appears to time out and die: "Couldn't connect to productads.amazon-digital-ftp.com"

I also use a FTP client, on default port (21), and I can connect just fine.

Am I doing something wrong with the script?

    The code I posted is the example code for ftp_connect(), it is example #1.

    I have also tried ftp_ssl_connect().

    Anyone have an idea?

      As the error message states, the problem is that PHP can't connect to the FTP server. Perhaps your host has a firewall and doesn't allow outbound FTP connections? This is something you'd have to ask your host.

        bradgrafelman;10946011 wrote:

        As the error message states, the problem is that PHP can't connect to the FTP server. Perhaps your host has a firewall and doesn't allow outbound FTP connections? This is something you'd have to ask your host.

        Thank you, was not a firewall issue but it was a host issue.

          Write a Reply...