PHP Classes

Loving it...but....

Recommend this page to a friend!

      smb4php  >  All threads  >  Loving it...but....  >  (Un) Subscribe thread alerts  
Subject:Loving it...but....
Summary:Some suggestions of how it might be a bit better
Messages:2
Author:Colin McKinnon
Date:2009-11-24 10:28:45
Update:2010-01-24 21:59:44
 

  1. Loving it...but....   Reply   Report abuse  
Picture of Colin McKinnon Colin McKinnon - 2009-11-24 10:28:45
Hi Victor,

I think your script is well-written and is certainly useful for me.

If you could stand a little criticism:

1) it could do with some documentation on how to use it - I've managed to reverse engineer that the format of the url should be:

smb://[[domain;]user[%password]@]server/sharename/path/to/file

2) it doesn't handle failures gracefully.

- I've changed the E_USER_ERROR constants to E_USER_WARNING to prevent the script from bombing out when an error occurs.

- I've changed the return value from smb_stream_wrapper::stream_open() from 'return TRUE;' to 'return is_resource($this->stream);' but that doesn't give me the expected behaviour for non-existent/non-accessible files (file_get_contents() now returns an empty string instead of false)

C.

  2. Re: Loving it...but....   Reply   Report abuse  
Picture of William M William M - 2010-01-24 21:59:44 - In reply to message 1 from Colin McKinnon
I have not been able to get this class to work.

I am a newbie with PHP classes, and was hoping for a simple example of opening a connection with this class.

I need open a file on a Windows UNC share. I am using PHP 5.2/IIS 6.0/fastCGI. I know how to handle files and streams and all that, but I can't get a successful file handle from fopen.

Would it be possible to post a little sample code using this class?

Thanks in advance,

William