Problem with ftp_connect and gethostbyname on PHP 4

I've got this error message :
Warning: ftp_connect(): php_network_getaddresses: gethostbyname failed in xxxxxxxxxxxxxxxxxxx

Here the code :

// set up basic connection
$ftp_server = "";

$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); ;

// login with username and password
$login_result = ftp_login($conn_id, "anonymous", "");

// get contents of the current directory
$contents = ftp_nlist($conn_id, "./ss/Parachiot/");

// output $contents


** Question PAQ'd and points refunded as the asker found solution himself - ldbkutty/Page Editor **
Who is Participating?
bruno_boccaraAuthor Commented:
That's ok I've got the answer.

its because we don't need to put ftp:// in $ftp_server.

the good syntax is $ftp_server = "";
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.