PHP has an LDAP extension. As long as your PHP installation has that extension enabled, you should be able to effortlessly connect to an AD server and perform your queries.
After that, it's just a matter of performing basic function calls: ldap_connect()
, ldap_bind()
, ldap_search()
, ldap_get_entries()
and then iterating over the result set.
Keep in mind that if you wish to perform changes to AD (which doesn't seem to be the case here), you'll have to connect through SSL, which might have a few gotchas involving making PHP see your AD's SSL certificate as trusted.