cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Using curl for a sftp connection

From: Benedikt Allkemper <b.allkemper_at_web.de>
Date: Thu, 17 May 2007 21:37:11 +0200

Hello,

I want to download a file from my server using ftp over ssl.
I can establish a ftp-connection with the following lines of code:

-----
$filehandler = fopen("myfile.txt", "w");
$url = "ftp://username:pw@host:21/path/file";
   
$handle = curl_init();
 
curl_setopt($handle, CURLOPT_UPLOAD, 0);
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($handle, CURLOPT_FILE, $filehandler);

$result = curl_exec($handle);

$info = curl_getinfo ($handle);

curl_close($handle);
-----

Changing the second line to $url =
"ftps://username:pw_at_host:21/path/file"; does not establish an encrypted
connection.
I've read and tried to understand the plenty of options and did a lot of
trial and error, but wasn't able to get a sftp connection.

Can you tell me please, what I've to change.

Thank you!
Regards
Bene
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-05-17