Net_LDAP error message.
| From: | Ryan Taylor | Date: | Thu, 24 Apr 2008 10:43:17 +0000 |
| Subject: | Net_LDAP error message. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-28826@lists.php.net to get a copy of this message | ||
Hi all,
I've been playing with the Net_LDAP package to generate a list of user
accounts for a telephone directory.
I've got the following code from the package documentation:
<?php
// Inclusion of the Net_LDAP package:
require_once 'Net/LDAP.php';
error_reporting(E_ALL);
// The configuration array:
$config = array (
'binddn' => '####',
'bindpw' => '####',
'basedn' => 'OU=staffusers,DC=leeds-art,DC=ac,DC=uk',
'host' => 'rizzo.leeds-art.ac.uk'
);
// Connecting using the configuration:
$ldap = Net_LDAP::connect($config);
$filter = Net_LDAP_Filter::create('sn', 'begins', 'T');
$searchbase = 'OU=staffusers,DC=leeds-art,DC=ac,DC=uk';
$options = array(
'scope' => 'sub',
'attributes' => array('sn')
);
$search = $ldap->search($searchbase, $filter, $options);
$entry = $search->sorted(array('sn', 'gn'), SORT_DESC);
$staff = $entry->getValues('sn');
echo '<pre>';
print_r($staff);
echo '</pre>';
echo "Found " . $search->count() . " entries!";
?>
But I get an error message:
Fatal error: Call to a member function getValues() on a non-object in
/webdata/sites/common/dev/Net_LDAP/index.php on line 29
With the getValues() method. Does anyone know why?
I know there are 14 entries that the search is returning.
Cheers
Ryan