note 83211 deleted from function.opendir by cmb
| From: | cmb@php.net | Date: | Tue, 11 Jun 2019 06:38:25 +0000 |
| Subject: | note 83211 deleted from function.opendir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211219@lists.php.net to get a copy of this message | ||
Note Submitter: info at myweb dot lu
----
Read a Windows SMB Directory ;)
<?
function SMBMap($username, $password, $server, $dir) {
$command = "mount -t smbfs -o username=$username,password=$password //$server/$dir
/mnt/tmp";
echo system($command);
}
function SMBRelease() {
$command = "umount /mnt/tmp";
echo system($command);
}
function GetFiles($dir) {
$files = array();
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$files[] = $file."{".filetype("$dir/$file")."}";
}
closedir($dh);
}
}
return $files;
}
SMBMap("Daniel", "", "10.0.0.2", "Kram");
$any = GetFiles("/mnt/tmp");
SMBRelease();
print_r($any);
?>