duanmen1887
2013-05-27 06:53
采纳率: 0%
浏览 75
已采纳

samba web客户端 - 在php脚本中设置连接

I have to establish connection with Samba server from my php script in order to download some files into my local server.

Actually its first time I have heard of something like Samba so I Tried to look for a opensource code that I could make use of.

Here it is what I have found: First class - smbclient.php and I tried code posted on the page:

<?php

require_once ('smbclient.php');

$smbc = new smbclient ('//10.0.1.1/example', 'exampleuser', 'examplepassword');

if (!$smbc->get ('path/to/desired/file.txt', '/tmp/localfile.txt'))
{
    print "Failed to retrieve file:
";
    print join ("
", $smbc->get_last_stdout());
}
else
{
    print "Transferred file successfully.";
}

?>

Adjusting it into my needs ( server, user, password), all i got is

Failed to retrieve file: 
Fatal error: Call to undefined method smbclient::get_last_stdout() 

Then I found out about smbwebclient.php project which looks awesome and can be found here.

And this class looks good but the problem is that I have no idea how to use it. Can anyone post it example connection or link to tutorial?

2条回答 默认 最新

相关推荐 更多相似问题