Retrieve Active directory attributes in php

I have a php file to make authentication with active director,i need to get the attribute named url for a specific user to return it from the function,how can this be done?

<?php
// Initialize session
session_start();

function authenticate($user, $password) {
if(empty($user) || empty($password)) return false;

// Active Directory server
$ldap_host = "CRAMSDCR01V.cloud4rain.local";

// connect to active directory
$ldap = ldap_connect($ldap_host);

$ldap_dn="OU=by-style,DC=cloud4rain,DC=local";

// verify user and password
if($bind = @ldap_bind($ldap, $user, $password)) 
{
    $result = ldap_search($ldap,$ldap_dn, "(cn=*)") or die ("Error in search query: ".ldap_error($ldap));
    $data = ldap_get_entries($ldap, $result);

    $info = $data['url'];

    return $info;   

} 
else 
{
    // invalid name or password
    return false;
}
}
?>


Source: stackoverflow-php