0

Ive got a website where i want to open a file from another server. this server is connected using a network drive.

The file uses Windows authentication. Because of this, using

echo file_get_contents('\\\**.**.local/data/user/*/*.xlsx');

results in

file_get_contents(\\*.*.local/data/user/*/*.xlsx) [function.file-get-contents]: failed to open stream: Permission denied

I found a similar problem here: How to use file_get_contents() to retrieve a file behind Windows NT Auth

But I cant get it to work. Using this:

getUrl('\\\*.*.local/data/user/*/*.xlsx','username','password');

Always results in :

Could not resolve host: \\*.*.local

Using

getUrl('file://*.*.local/data/user/*/*.xlsx','username','password');

gives me

Couldn't open file /data/user//.xlsx

What am I doing wrong?

Community
  • 1
  • 1
Simon Balling
  • 481
  • 1
  • 5
  • 14

1 Answers1

0

I think you can both use:

getUrl('file:////*.*.local/data/user/*/*.xlsx','username','password');

or

getUrl('file://\\*.*.local\data\user\*\*.xlsx','username','password');
huysentruitw
  • 27,376
  • 9
  • 90
  • 133
  • `getUrl('file:////*.*.local/data/user/*/*.xlsx','username','password');` gives me : `Couldn't open file //*.*.local/data/user/*/*.xlsx` `getUrl('file://\\*.*.local\data\user\*\*.xlsx','username','password');` gives me `Couldn't open file /data/user/*/*.xlsx` – Simon Balling Dec 16 '14 at 10:29
  • Try the url in a file-explorer first – huysentruitw Dec 16 '14 at 11:49
  • I am not 100% sure its the path that creates the problem. It also could be the username/password. I tried "username" abd "domain\username" but both didnt work. – Simon Balling Dec 16 '14 at 13:15