Poonam Bhatt
Poonam Bhatt

Reputation: 10302

How do I connect to ftps server through php?

I want to connect to ftps server through php. I am using ftp_connect()

But I am getting this warning while connection:

Warning: ftp_connect() [function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known.

can any one help?

Upvotes: 7

Views: 17111

Answers (2)

PHP has a built-in function for connecting to "FTPS" servers, since secure FTP is over an SSL connection. Check out the documentation for ftp_ssl_connect.

http://us.php.net/manual/en/function.ftp-ssl-connect.php

Hope this helps!

Upvotes: 4

Nik
Nik

Reputation: 4075

This means, it is not able to find the FTP server you are trying to connect. Either domain name doesn't exist or name resolution failed.

I guess, you are trying to connect as,

$server = 'ftpserver,port';
$connection = ftp_connect($server);

For which you can use,

$server = 'ftpserver'; 
$port = 'port'; 
$connection  = ftp_connect($server,$port); 

Hope this helps.

If it does not work, Please check manual for ftp_connect again.

http://php.net/manual/en/function.ftp-connect.php

Upvotes: -1

Related Questions