我目前从var_dump获得错误结果。有没有办法从FTP帐户获取根目录下的文件夹和文件的结果。
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "ftp://www.xxxx.co.uk");
curl_setopt($ch, CURLOPT_USERPWD, "[xxxx]:[xxxx]");
// grab URL and pass it to the browser
$result = curl_exec($ch);
var_dump($result);
// close cURL resource, and free up system resources
curl_close($ch);
?>
答案 0 :(得分:1)
为什么不使用ftp_connect
$ftp = ftp_connect("ftp.xxxx.co.uk") or die('could not connect.');
$raw = ftp_login($ftp, "anonymous", "") or die('could not login.');
$raw = ftp_pasv($ftp, true) or die('could not enable passive mode.');
$raw = ftp_rawlist($ftp, "/public_html/");
var_dump($raw);