Skip navigation
Currently Being Moderated

CF9 - convert LDAP data into associative array?

May 10, 2013 9:51 AM

Hello, everyone.


Does anyone have any suggestions on a good way to convert LDAP data into an associative array with the key being the fieldname?


For example:

dn: CN=First Last, OU=Dept A, OU=Dept B, OU=Domain Users,DC=hq,DC=domainname,DC=com
changetype: edit
sn: Last
description: Dept C
telephoneNumber: xxx-xxx-xxxx
givenName: First
empID: ab1234x


There are several thousand similar to the above; some will have three lines of data, some as many as twelve, each individual separated by double line breaks (<br />).  I need to make an array where "dn", "changetype", "sn", etc., are the keys with the text after the colon as the value.


What is the best way to do this?


Thank you,



  • Currently Being Moderated
    May 10, 2013 10:12 AM   in reply to WolfShade

    What is the source of the data?  Is it a text file with the above data?  Is it an LDAP query?  Spreadsheet?



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points