Answer the question
In order to leave comments, you need to log in
Square brackets in paths when working via FTP via PHP?
Get a list of files in a directory. I use:
$conn_id = ftp_connect('ftp-serv');
$login_result = ftp_login($conn_id, 'login', 'pass');
$buff = ftp_rawlist($conn_id,$path);
print_r($buff);
ftp_close($conn_id);
(php 5.3.3) Answer the question
In order to leave comments, you need to log in
Mb help screening?
Then curl should help:
$login = '';
$pass = '';
$server = 'ftp.com';
$ch = curl_init('ftp://'.$login.':'.$pass.'@'.$server.'/dir[/');
curl_setopt($ch, CURLOPT_FTPLISTONLY, true); //Вернёт список директорий
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$dirs = curl_exec($ch);
var_dump(explode(PHP_EOL,$dirs));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question