2009-01-14 28 views

回答

9

使用NET::LDAP模塊。

一個小例子從POD

use Net::LDAP; 

$ldap = Net::LDAP->new('ldap.bigfoot.com') or die "[email protected]"; 

$mesg = $ldap->bind ; # an anonymous bind 

$mesg = $ldap->search(# perform a search 
         base => "c=US", 
         filter => "(&(sn=Barr) (o=Texas Instruments))" 
        ); 
$mesg->code && die $mesg->error; 

foreach $entry ($mesg->entries) { $entry->dump; } 

$mesg = $ldap->unbind; # take down session 
+0

我應該把什麼參數上$ LDAP->搜索()來獲取服務器中的所有用戶? – lamcro 2009-01-14 12:16:46

相關問題