Forum Moderators: coopster
$ad = ldap_connect("ldap://ourldapserver.co.uk") or die("Couldn't connect to AD!");
$r=ldap_bind($ad);
$sr=ldap_search($ad, "ou=people,dc=ourcompany,dc=co,dc=uk", "mail=some.user@ourcompany.co.uk");
echo "Number of entires returned is " . ldap_count_entries($ad, $sr) . "<br />";
$info = ldap_get_entries($ad, $sr);
for ($i=0; $i<$info["count"]; $i++) {
echo "Your name is " . $info[$i]["cn"][0] . "<br />";
echo "and your email is " . $info[$i]["mail"][0] . "<br />";
echo "and your username is " . $info[$i]["uid"][0];
}
ldap_close($ad);
I want to adapt this however to retrieve all the members of an email distribution list, for example admin-staff@ourcompany.co.uk. Anyone have any ideas on how I could adapt my existing code to do this?
It's one of those backburner projects which I've resigned myself to having to write and update the lists and manually - the laborious and boring way!
I'd still be very interested if anyone does have any ideas though!
I don't really know that much about ldap and whether the variable names and things are standard for everyone or whether each IT dept write their own? I haven't yet found a comprehensive reference resource for this.