Aleš
Aleš

Reputation: 15

can not open the share folder via command openDir

I have problem with command openDir on our network share space

use:

openDir( '\\\\172.17.50.8\tsbnb_rw' );

and error is below:

Warning: opendir(\\172.17.50.8\tsbnb_rw,\\172.17.50.8\tsbnb_rw) [function.opendir]: Access is denied. (code: 5)

This share folder needed authorization user and password, but I have no idea how to set this.

Upvotes: 1

Views: 1155

Answers (2)

Loopo
Loopo

Reputation: 2195

try reading the manual; for samba under linux, there's an example here:

opendir

Upvotes: 0

Mayank Sharma
Mayank Sharma

Reputation: 829

You can try this:

<?php

// Define the parameters for the shell command
$location = "\\servername\sharename";
$user = "USERNAME";
$pass = "PASSWORD";
$letter = "Z";

// Map the drive
system("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");

// Open the directory
$dir = opendir($letter.":/an/example/path")

...

?>

Upvotes: 1

Related Questions