Cannot connect with FTP server with PHP , ftp_connect()

后端 未结 2 2198
無奈伤痛
無奈伤痛 2021-02-20 03:24

I was trying to connect with ftp server using ftp_connect() function of PHP as shown below:



        
相关标签:
2条回答
  • 2021-02-20 03:37

    You must supply only the ftp server hostname, rather than the hostname and directory path, and the irrelevant http:// since this is an FTP connection.

    $ftp_server = "ftp.mozilla.org";
    $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 
    
    // Then chdir to the correct directory:
    ftp_chdir($conn_id, "/pub/mozilla.org");
    

    See the full documentation of PHP's FTP functions.

    0 讨论(0)
  • 2021-02-20 03:49

    Get rid of the http://, it is not part of the server address.

    0 讨论(0)
提交回复
热议问题