passing user and password with FOPEN

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dickey
Forum Commoner
Posts: 50
Joined: Thu May 16, 2002 8:04 pm
Location: Sydney, Australia

passing user and password with FOPEN

Post 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
joseluisloya
Forum Newbie
Posts: 3
Joined: Tue Jul 18, 2006 10:56 pm

Post 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.
Post Reply