I hope someone can help me with this problem please:
I'm trying to use cURL to transfer a file from my machine to a remote server using SSL but I just keep getting time-outs. I can connect to the server fine using a separate application (Cyberduck) but I've tried all different combinations of cURL options without success and the only error message that gets reported is 35 (CURLE_SSL_CONNECT_ERROR).
According to Cyberduck, the SSL connection it uses is "Explicit Auth TLS" and when I log in I get this information:
Code: Select all
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 6 of 1000 allowed.
AUTH TLS
234 AUTH TLS OK.
USER myusername
331 User myusername OK. Password required
PASS ********
230 OK. Current restricted directory is /
PBSZ 0
200 PBSZ=0
PROT P
200 Data protection level set to "private"In case this information is relevant, I'm using PHP v5.3.5 and have cURL v7.21.3 and here is my code - I'm not trying to transfer any files here, just get a directory listing:
Code: Select all
$ftp_server = 'ftps://255.255.255.255:21/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $ftp_server);
curl_setopt($curl, CURLOPT_FTPLISTONLY, 1);
curl_setopt($curl, CURLOPT_USERPWD, "myusername:mypassword");
curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
curl_setopt($curl, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$result = curl_exec($curl);
$error_no = curl_errno($curl);
if ($error_no == 0) {
echo 'Connection made';
} else {
echo 'Connection failed: ' . $error_no;
}
curl_close($curl);Mecha Godzilla