Reputation: 1499
I am currently getting a false result from my var_dump. Is there any way to get the result of folders and files on the root directory from a FTP account.
<?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);
?>
Upvotes: 0
Views: 1406
Reputation: 95101
Why don't you use 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);
Upvotes: 1