And if it turns out curl doesn't do the trick in your case, try "ldapsearch" from the standard OpenLDAP utils.
ldapsearch has an option to download attribute-values to a temp-file.
From "man ldapsearch":
-t Write retrieved non-printable values to a set of temporary files. This is useful for dealing with values containing non-character data such as jpegPhoto or audio.