Using PHP and LDAP to connect to AD

By k.grey ·
Hi there,

apologies for any mistakes as this is my first post.

I am trying to retrieve the PO box in the address information from a user in Active Directory using some kind of php coding. I have found various examples but cannot find a simple step by step guide as I am a novice in this area. I currently have an AD on server 2008 with a web page on a web server(also 2008, running IIS) that is coded in php and I need to retrive the PO box from an active directory entry for a user. Is this possible.

Thanks in advance

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Re: Using PHP and LDAP to connect to AD

by Peconet Tietokoneet In reply to Using PHP and LDAP to con ...
Collapse -

binding ldap

by k.grey In reply to Re: Using PHP and LDAP to ...


The link was useful. However when using the ldap functions I have some strange responses.

I have been using this code:

$ad = ldap_connect("ldap://HPHS.INTERNAL")
or die("Couldn't connect to AD!");

$bd = ldap_bind($ad,"Options.HPHS.INTERNAL","password")
or die("Couldn't bind to AD!");

When i use the ldap connect function and load the webpage there are no errors, however when i add the bind function it states that the user is invalid even though it isnt. Stranger still, when i close the webpage and then reopen it with the above code in i get a server error HTTP 500, rather than the invalid credentials error???

I have not prepped my AD in anyway to recieve ldap connections, will i need to change a setting somewhere??

Thank you for your quick response

Related Discussions

Related Forums