I need to access a list of files in an FTP server, but for some reason, I cannot connect to it.
<?php
$ftp_server = "ftp.nhc.noaa.gov";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, "anonymous", "email@gmail.com");
$file_list = ftp_nlist($ftp_conn, ".");
var_dump($file_list);
ftp_close($ftp_conn);
?>
When I run the code above, I get this error:
Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/prww/public_html/hurricane/test.php on line 3
How can I successfully connect to this server and get a list of its files?