tanveer Posted November 5, 2009 Share Posted November 5, 2009 Hello all, I didn't know under which topic to post the problem in this forum so posted here. If u feel to move it to any other section then please. THe problem is I have implemented a test ldap server and can communicating with it with PHP. I can fetch all data from openldap except one which is labelURI under objectClass inetOrgPerson. I dont know why. In errro log its giving me this error: PHP Notice: Undefined index: labeledURI in /var/www/html/peer2/test.php on line 17 and below is my code and ldif file of openldap: ## DEFINE DIT ROOT/BASE/SUFFIX #### ## uses RFC 2377 format ## dcObject is an AUXILLIARY objectclass and MUST ## have a STRUCTURAL objectclass (organization in this case) ## this is an ENTRY sequence and is preceded by a BLANK line dn: dc=example,dc=com dc: example description: test domain objectClass: dcObject objectClass: organization o: example, Inc. ## FIRST Level hierarchy - people ## uses mixed upper and lower case for objectclass ## this is an ENTRY sequence and is preceded by a BLANK line dn: ou=people, dc=example,dc=com ou: people description: All people in organisation objectclass: organizationalunit ## SECOND Level hierarchy ## ADD a single entry under FIRST (people) level ## this is an ENTRY sequence and is preceded by a BLANK line ## the ou: Project Management is the department name dn: cn=J Stefan,ou=people,dc=example,dc=com objectclass: inetOrgPerson cn: J Stefan homephone: 514-111-2222 mail: [email protected] labeledURI: http://p2.example.com/~j_stefan description: Group Owner ou: Project Management dn: cn=John Abrus,ou=people,dc=example,dc=com objectclass: inetOrgPerson cn: John Abrus homephone: 514-443-1163 mail: [email protected] labeledURI: http://p1.example.com/~jabrus description: Group Member PHP coding part: <?php $conn= ldap_connect ("ldapserver-ip-here") or die ("cant connect"); $r = ldap_bind($conn) or die ("could not bind"); $result=ldap_search ($conn,"ou=people,dc=example,dc=com", "(cn=*)") or die ("sorry"); $info = ldap_get_entries($conn,$result); for ($i=0;$i<$info["count"];$i++) { echo "CN = ". $info[$i]["cn"][0] . "<br>"; echo "Desc = ". $info[$i]["description"][0] . "<br>"; echo "Mail= ". $info[$i]["mail"][0] . "<br>"; echo "URL = ". $info[$i]["labeledURI"][0] . "<br>"; echo "phone = ". $info[$i]["homephone"][0] . "<br>"; } echo "number of entries found=" . ldap_count_entries($conn,$result) . "<p>"; ldap_close($conn); ?> Any suggestions. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/180368-problem-in-fetching-only-one-data-from-openldap/ Share on other sites More sharing options...
tanveer Posted November 8, 2009 Author Share Posted November 8, 2009 echo "URL = ". $info[$i]["labeledURI"][0] . "<br>"; this should be echo "URL = ". $info[$i]["labeleduri"][0] . "<br>"; Link to comment https://forums.phpfreaks.com/topic/180368-problem-in-fetching-only-one-data-from-openldap/#findComment-953720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.