I'm having some trouble using scandir - I have it working fine on one site but now I'm wanting to scan the same directory on that site but from a different website.
I'm using the following code:
array_diff(scandir('http://sub.domain.co.uk/folder/folder/'), array('.', '..'));
and I get this error:
Warning: scandir(http://sub.domain.co.uk/folder/folder/): failed to open dir: not implemented
I've had a Google but brought up very little - I've tried enabling directory listing on the external site and allow_fopen_url is enabled as well.
I'm stumped, any help with this one?Answer1:
Assuming you have the ftp extension loaded in PHP (<a href="http://www.php.net/manual/en/book.ftp.php" rel="nofollow">PHP: FTP</a>), you could:
$connect = ftp_connect($ftp_server); $login_result = ftp_login($connect, $username, $password); $contents = ftp_nlist($connect, "."); print_r($contents);Answer2:
This turned out to be a loop back problem, I was trying to scan a a folder on the same domain which was not allowed with my host.
I've had to introduce a 'state' to deal with this which says whether the software is live or not (because the software, once live, will actually point to a different domain).