PHPBuilder - smb4php: a smb stream wrapper

RSS Twitter
Tips Php Functions

smb4php: a smb stream wrapper

by: Victor M Varela
October 15, 2007

smb4php is a 'smbclient' based stream wrapper for PHP to access files and folders shared by an SMB server in a transparent way. You will be able to use fopen, fclose, fwrite, fgets, opendir, readdir, unlink, etc. using an URL "smb://user:pass@server/share/path";.

include "smb.php";

$dir = "smb://server/disk";
if(is_dir($dir)) {
   $dh = opendir($dir);
   while(($file=readdir($dh)) !== false) {
       echo "filename: $file - filetype: ".filetype($dir.'/'.$file)."\n";
else {
   echo $dir." n'est pas un répertoire
\n"; }

Comment and Contribute

Your comment has been submitted and is pending approval.

Victor M Varela



(Maximum characters: 1200). You have characters left.