Walid Walid - 1 month ago 4
PHP Question

Active Directory Filter PHP

I am trying to fetch my active directory contacts using PHP, this is the domain: `'OU=Shop,OU=US,OU=test,DC=com,DC=def,DC=intra'.

However, i have 12 countries to search for, so instead of 'US' i need also to search for 'FRA' 'UK',... & i need only the contacts that are in the 'shop' OU, i tried something like this, but it the search filter is wrong :


so how can i make a similar search filter that returns only the shop in every country ?


Like @mvrejin said, you cannot create a search filter that way, i would suggest adding those contacts or shops you are talking about to a certain group (Shops_ for example) and adding the group in the search filter, like so :

$search_filter = '(&(objectCategory=person)(memberOf=cn=Shops_,ou=something,DC=com,DC=def,DC=intra))';