PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ákos Nikházy   Simple AD PHP LDAP Search Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple AD PHP LDAP Search Class
Search for people in Active Directory using LDAP
Author: By
Last change:
Date: 1 year ago
Size: 587 bytes
 

Contents

Class file image Download
<pre>
<?php
require('ADSearch.class.php');

// Make object.
// also it could be: $search = new ADSearch('user@domain.com','VerySecurePassword','0.0.0.0','389','DC=example,DC=com')
$search = new ADSearch();

// Do the search. Its false if something went wrong.
if($result = $search -> Search('John Smi'))
{
   
   
var_dump($result);
   
}
else
    echo
'Search failed';

echo
'<hr>';

// also it could be: $sarch -> Search('Smith',array('displayname','samaccountname','mail'));
if($result2 = $search -> Search('Jane Smith',array('mail')))
{
   
   
var_dump($result2);
   
}
else
    echo
'Search failed';