Page 1 of 1

passing user and password with FOPEN

Posted: Wed Jul 12, 2006 4:47 pm
by dickey
The PHP docs quote that you can pass user credentials with ftp and http protocol.

$handle = fopen("ftp://user:password@example.com/somefile.txt", "w");

But how about an intranet application

where the server address is say ausydnvvvppp04 and is accessible usually on the intranet by typing http://ausydnvvvppp04 and where I wish to write a file to a hidden share on that box say ausydnvvvppp04/share$ and I wish to pass active directory credentials to access the share eg user = test, and password = testpwd.

I am not sure what the correct syntax is to achieve that.

Any assistance will be greatly appreciated.

- Andrew

Posted: Tue Jul 18, 2006 11:09 pm
by joseluisloya
just put a backslash behind the $

$handle = fopen("ftp://user:password@example.com/\$hiddenfile", "w");

So, \$, and you dont will have problems..

Good look

JoseLuis Loya.