note 77113 added to function.ldap-add
| From: | Willie at osu1 dot php dot net | Date: | Wed, 15 Aug 2007 21:16:59 +0000 |
| Subject: | note 77113 added to function.ldap-add | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129507@lists.php.net to get a copy of this message | ||
In response to:
Note that you cannot use base64 encoding, you have to use utf-8 encoding for special chars instead.
--
I have found that if I have a special character (or a newline) that ldap_add and ldap_modify will
automatically do the base64 encoding for you. For example:
<?php
// assuming binding is done, etc.
$entry['postalAddress'] = "123 East 456 West\nSuite A103";
ldap_modify($ds, $dn, $entry);
?>
The function or server will take the newline and convert it into base64 automatically (same goes for
other special characters).
You may be able to verify by using a command-line ldapsearch
ldapsearch -b "dc=example,dc=com" -x "(cn=Example Person)" postalAddress
You'll see that the result comes up as
dn: cn=Example Person,dc=example,dc=com
postalAddress:: MTIzIEVhc3QgNDU2IFdlc3QKU3VpdGUgQTEwMw==
See the double colons after postal address? That's how LDAP states it's base64 encoded in
this case.
----
Server IP: 64.71.164.2
Probable Submitter: 208.47.173.116
----
Manual Page -- http://www.php.net/manual/en/function.ldap-add.php
Edit -- https://master.php.net/note/edit/77113
Del: integrated -- https://master.php.net/note/delete/77113/integrated
Del: useless -- https://master.php.net/note/delete/77113/useless
Del: bad code -- https://master.php.net/note/delete/77113/bad+code
Del: spam -- https://master.php.net/note/delete/77113/spam
Del: non-english -- https://master.php.net/note/delete/77113/non-english
Del: in docs -- https://master.php.net/note/delete/77113/in+docs
Del: other reasons-- https://master.php.net/note/delete/77113
Reject -- https://master.php.net/note/reject/77113
Search -- https://master.php.net/manage/user-notes.php