php to access shared smb folder (user/password protected)

Jiří Doubravský picture Jiří Doubravský · Jan 17, 2012 · Viewed 10.7k times · Source
  1. WAMP server
  2. PHP fopen function needs to open file in shared folder //server/folder1/file1.txt
  3. php has SYSTEM user permisions, but shared folder is visible only for userX/password

how can i open this remote file inside php script?

Answer

Sjoerd picture Sjoerd · Jan 17, 2012

You can specify the username and password in the path: //user:password@server/folder1/file1.txt