Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Problem with ftp_connect and gethostbyname on PHP 4

Posted on 2005-05-13
2
Medium Priority
?
1,089 Views
Last Modified: 2013-12-13
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 = "ftp://xxx.xxx.xxx.xxx";

$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", "anonymous@nowhere.com");

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

// output $contents
var_dump($contents);

//////////////////////////////////////


** Question PAQ'd and points refunded as the asker found solution himself - ldbkutty/Page Editor **
0
Comment
Question by:bruno_boccara
1 Comment
 

Accepted Solution

by:
bruno_boccara earned 0 total points
ID: 13994390
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 = "xxx.xxx.xxx.xxx";
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question