title: Getting user readable name via LDAP with PHP by having only the login credentials
body: <p>I am integrating my login form with Microsoft active directory. I authenticate
  users via LDAP php library.</p>
  
  <p>When user try to log in, they enter username &amp; password.
  Connecting to server go successfully, authentication via "LDAP_bind" also 
  give me true or false according to the values correctness.
  Now i am not able to retrieve the user Real name to display it on the screen.</p>
  
  <p>ALL Information I have are the ldap uri with the port number, and username &amp; password entered via the webform.</p>
  
  <p>here is my current code,</p>
  
  <pre><code>$ldap = ldap_connect("ldap://abc.xyz:123");
  if ($bind = ldap_bind($ldap, $_REQUEST['username'].'@abc.xyz',$_REQUEST['password'])) 
  { echo "Welcome". $_REQUEST['username'];}
  </code></pre>
  
  <p>the $_REQUEST['username'] is not human readable, so i need to read this user attributes or at least display name only. </p>
  
  <p>ldap_search and ldap_read functions did not help, I tried this code:</p>
  
  <pre><code>$ldap_base_dn = 'DC=abc,DC=xyz';
  $search_filter = "(objectclass=*)";
  $result = ldap_search($ldap_connection, $ldap_base_dn, $search_filter);
  </code></pre>
  
  <p>with no luck, is there any other information i must have in order to make the ldap_search or ldap_read work successfully. in other words can this be done by having the username and password and the ldap uri only?</p>