Yes! Thanks for pointing my fault. As I'm not using this query in a function, I forgot changing return $results; to echo $results;
I firstly trying to add this code inside the original in a function with no luck. Then I have blank vphonebook.php and fill it with this code only but still not working. Finally Nicolas help me to fix the problem.
D
dsisevran
@dsisevran
Posts
-
Using FOP2 Phonebook with LDAP server -
Using FOP2 Phonebook with LDAP serverThank Nicolas for your help.
Finally as I only use ldap for my search my vphonebook.php look like<?php $texto = $_REQUEST['term']; // ---------------------------- VARIABLES ---------------------------- $ldapURL = 'LDAP_URL'; $ldapPort = 389; // Port par defaut = 389 $ldapVersionProtocole = 3; // Version par defaut = 2 $ldapIdentifiant = 'cn=ADMIN,dc=DOMAIN,dc=COM'; $ldapMotDePasse = 'PASSWD'; // ---------------------------- CONNEXION ---------------------------- $ldap = ldap_connect($ldapURL, $ldapPort); if (false === $ldap) die('Echec de la connexion'); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, $ldapVersionProtocole); $retour = ldap_bind($ldap, $ldapIdentifiant, $ldapMotDePasse); if (false === $retour) die('Echec de l\'authentification (ou de la connexion)'); // ---------------------------- RECHERCHE ---------------------------- $dn = "OU=PERSON,DC=DOMAIN,DC=COM"; $recherche = "UID=*$texto*"; $requete = ldap_search($ldap, $dn, $recherche); if (false === $requete) die('La recherche a echoue'); // ---------------------------- RESULTAT ---------------------------- $resultats = ldap_get_entries($ldap, $requete); $myArray = array(); for ($i=0; $i<$resultats["count"]; $i++) { $myArray[] = "{\"name\":\"\",\"value\":\"" . $resultats[$i]["cn"][0] . " <" . $resultats[$i]["telephonenumber"][0] . ">\"}"; } // ---------------------------- FORMATAGE ---------------------------- //print_r($myArray); $results = json_encode($myArray,JSON_UNESCAPED_UNICODE); $results = str_replace('\"', '"', $results); $results = str_replace('"{', '{', $results); $results = str_replace('}"', '}', $results); // ---------------------------- FERMETURE ---------------------------- ldap_close($ldap); echo $results; ?> -
Using FOP2 Phonebook with LDAP serverI have wrote a little script to query on LDAP and formating the result in a json array but not working when adding it in vphonebook.php
<?php // ---------------------------- VARIABLES ---------------------------- $ldapURL = 'LDAP_URL'; $ldapPort = 389; // Port par defaut = 389 $ldapVersionProtocole = 3; // Version par defaut = 2 $ldapIdentifiant = 'cn=ADMIN,dc=DOMAIN,dc=COM'; $ldapMotDePasse = 'PASSWD'; // ---------------------------- CONNEXION ---------------------------- $ldap = ldap_connect($ldapURL, $ldapPort); if (false === $ldap) die('Echec de la connexion'); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, $ldapVersionProtocole); $retour = ldap_bind($ldap, $ldapIdentifiant, $ldapMotDePasse); if (false === $retour) die('Echec de l\'authentification (ou de la connexion)'); // ---------------------------- RECHERCHE ---------------------------- $dn = "OU=PERSON,DC=DOMAIN,DC=COM"; $recherche = "UID=*$texto*"; $requete = ldap_search($ldap, $dn, $recherche); if (false === $requete) die('La recherche a echoue'); // ---------------------------- RESULTAT ---------------------------- $resultats = ldap_get_entries($ldap, $requete); $myArray = array(); for ($i=0; $i<$resultats["count"]; $i++) { $myArray[] = "{\"name\":\"\",\"value\":\"" . $resultats[$i]["cn"][0] . " <" . $resultats[$i]["telephonenumber"][0] . ">\"}"; } // ---------------------------- FORMATAGE ---------------------------- //print_r($myArray); $results = json_encode($myArray,JSON_UNESCAPED_UNICODE); $results = str_replace('\"', '"', $results); $results = str_replace('"{', '{', $results); $results = str_replace('}"', '}', $results); // ---------------------------- FERMETURE ---------------------------- ldap_close($ldap); return $results; ?> -
Using FOP2 Phonebook with LDAP serverThanks

Yes I am working on a separate php file for testing only and then I will modify vphonebook.php. -
Using FOP2 Phonebook with LDAP serverWhitch syntax does the result have to be return for matching contact form query?
-
Using FOP2 Phonebook with LDAP serverThanks for the answer. Will try to do something before paid for a full licence. I have also see VOP which could do the trick. Will give a try.
Regards. -
Using FOP2 Phonebook with LDAP serverDear,
Is there any update concering this request?
Regards.