note 29195 added to ref.ldap

From: Date: Wed, 05 Feb 2003 21:04:53 +0000
Subject: note 29195 added to ref.ldap
Groups: php.notes 
Request: Send a blank email to php-notes+get-43477@lists.php.net to get a copy of this message
In some cases, when you're working on a system where PHP is pre-installed and you need to ask some mysterious and/or distant sysadmin to recompile it, you may want to forget about the LDAP functions and use the shell commands that seem to exist whenever the LDAP package is installed. For example, I want to look up someone's e-mail address ("mail") in the Institute LDAP address book database and fetch from it their surname ("sn"). I use the backtick operator, which executes a shell command and returns its output to PHP: $sn = ldapsearch -h ldap-server.its.caltech.edu "(mail=$email)" sn | grep "sn:"; $sn = trim(str_replace("sn:","",$sn)); This probably isn't a good idea if you want complicated things, but for an occasional simple use it's a nice hack, I thought. -- http://www.php.net/manual/en/ref.ldap.php http://master.php.net/manage/user-notes.php?action=edit+29195 http://master.php.net/manage/user-notes.php?action=delete+29195 http://master.php.net/manage/user-notes.php?action=reject+29195

« previous php.notes (#43477) next »