1. Go to this page and download the library: Download sgrabaum/smb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sgrabaum / smb example snippets
use Icewind\SMB\Server;
erver = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
$share->put($fileToUpload, 'example.txt');
use Icewind\SMB\Server;
txt';
$server = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
$share->get('example.txt', $target);
use Icewind\SMB\Server;
st', 'test', 'test');
$shares = $server->listShares();
foreach ($shares as $share) {
echo $share->getName() . "\n";
}
use Icewind\SMB\Server;
st', 'test', 'test');
$oServer->setConnectionEnv( [ 'LC_ALL' => 'de_DE.UTF-8', 'LANG' => 'de_DE.UTF-8' ] ); // de_DE.UTF-8 = german language and files with german characters
$share = $server->getShare('test', '?? M d H:i:s Y T'); // Format "?? M d H:i:s Y T" is german language date time result of smbclient, need for parser to get timestamp
$fh = $share->write('test.txt');
fwrite($fh, 'bar');
fclose($fh);
use Icewind\SMB\Server;
use Icewind\SMB\NativeServer;
$server = new NativeServer('localhost', 'test', 'test');
} else {
echo 'libsmbclient-php not available, falling back to wrapping smbclient';
$server = new Server('localhost', 'test', 'test');
}
$share = $server->getShare('test');
$share->put($fileToUpload, 'example.txt');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.