note 90988 added to function.curl-setopt
| From: | franciscocha at gmail dot com | Date: | Tue, 19 May 2009 22:11:25 +0000 |
| Subject: | note 90988 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155760@lists.php.net to get a copy of this message | ||
Example how to connect to FTPES (FTP explicit SSL). This script will connect to any FTPES server and
out put the list of directories.
<?php
$username = 'username';
$password = 'password';
$url = 'url';
$ftp_server = "ftp://" . $username . ":" . $password
. "@" . $url;
echo "Starting CURL.\n";
$ch = curl_init();
echo "Set CURL URL.\n";
//curl FTP
curl_setopt($ch, CURLOPT_URL, $ftp_server);
//For Debugging
//curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
//SSL Settings
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_FTP_SSL, CURLFTPSSL_TRY);
//List FTP files and directories
curl_setopt($ch, CURLOPT_FTPLISTONLY, TRUE);
//Output to curl_exec
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
echo "Executing CURL.\n";
$output = curl_exec($ch);
curl_close($ch);
echo "Closing CURL.\n";
echo $output . "\n";
$files = explode("\n", $output);
print_r($files);
?>
----
Server IP: 209.41.74.194
Probable Submitter: 64.0.147.226
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/90988
Del: integrated -- https://master.php.net/note/delete/90988/integrated
Del: useless -- https://master.php.net/note/delete/90988/useless
Del: bad code -- https://master.php.net/note/delete/90988/bad+code
Del: spam -- https://master.php.net/note/delete/90988/spam
Del: non-english -- https://master.php.net/note/delete/90988/non-english
Del: in docs -- https://master.php.net/note/delete/90988/in+docs
Del: other reasons-- https://master.php.net/note/delete/90988
Reject -- https://master.php.net/note/reject/90988
Search -- https://master.php.net/manage/user-notes.php