note 73636 added to function.ldap-search

From: Date: Mon, 05 Mar 2007 13:44:59 +0000
Subject: note 73636 added to function.ldap-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-124096@lists.php.net to get a copy of this message
I had problem searching into Microsoft Active Directory with ldap_search. System administrator does not want to change the 1.000 limit of returned result because of Domain Controler performance. Here is a example of code that activates the Page Mode. See "searching with ActiveX Data Objects (ADO)" on MSDN for more details. $connection = New COM("ADODB.Connection"); $commande = New COM("ADODB.Command"); $resultat = New COM("ADODB.Recordset"); $connection->Provider = "ADsDSOObject"; $connection->Open(); $commande->ActiveConnection = $connection ; $commande->Properties["Cache results"] = false; // ACTIVATE PAGE MODE $commande->Properties["Page size"] = 1000; $recherche1 = "<LDAP://OU=XXXX,OU=Ressources_Locales,DC=COMMUN, DC=AD,DC=YYYY,DC=FR>"; $recherche2 = ";(&(objectCategory=group) (sIDHistory=*));distinguishedname;subtree"; $commande->commandtext = $recherche1.$recherche2; $resultat = $commande->Execute(); $count = 0; while (!$resultat->eof()) { if ($count<10) echo $resultat["distinguishedname"]."<br>"; $resultat->MoveNext(); $count = $count +1; } echo $count."<br>"; ---- Server IP: 69.147.83.197 Probable Submitter: 171.16.4.5 (proxied: 10.27.253.130, unknown) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-search.php Edit -- https://master.php.net/note/edit/73636 Del: integrated -- https://master.php.net/note/delete/73636/integrated Del: useless -- https://master.php.net/note/delete/73636/useless Del: bad code -- https://master.php.net/note/delete/73636/bad+code Del: spam -- https://master.php.net/note/delete/73636/spam Del: non-english -- https://master.php.net/note/delete/73636/non-english Del: in docs -- https://master.php.net/note/delete/73636/in+docs Del: other reasons-- https://master.php.net/note/delete/73636 Reject -- https://master.php.net/note/reject/73636 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124096) next »