Zend\Ldap

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Zend\Ldap

Steve Rayner-2
I'm using this to make an LDAP query;

$ldap = new \Zend\Ldap\Ldap($options);
    $ldap->bind();
    $result = $ldap->search('(objectclass=*)',
                            'dc=wr,dc=local',
                            \Zend\Ldap\Ldap::SEARCH_SCOPE_ONE);


How would I then iterate over the results?
Reply | Threaded
Open this post in threaded view
|

Re: Zend\Ldap

Stefan Gehrig
See http://framework.zend.com/manual/2.3/en/modules/zend.ldap.usage.html#retrieving-data-from-the-ldap <http://framework.zend.com/manual/2.3/en/modules/zend.ldap.usage.html#retrieving-data-from-the-ldap>
Searching the LDAP tree

1
2
3
4
5
6
7
8
9
$options = array(/* ... */);
$ldap = new Zend\Ldap\Ldap($options);
$ldap->bind();
$result = $ldap->search('(objectclass=*)',
                        'ou=People,dc=my,dc=local',
                        Zend\Ldap\Ldap::SEARCH_SCOPE_ONE);
foreach ($result as $item) {
    echo $item["dn"] . ': ' . $item['cn'][0] . PHP_EOL;
Cheers
Stefan



> Am 12.12.2014 um 12:06 schrieb Steve Rayner <[hidden email]>:
>
> I'm using this to make an LDAP query;
>
> $ldap = new \Zend\Ldap\Ldap($options);
>    $ldap->bind();
>    $result = $ldap->search('(objectclass=*)',
>                            'dc=wr,dc=local',
>                            \Zend\Ldap\Ldap::SEARCH_SCOPE_ONE);
>
>
> How would I then iterate over the results?