|
HOWTO: Using
OiD with PHP LDAP calls
Prerequistires:
Server Side
- Oid 2.1.1 or LDAPv3 Server
Client Side
-เราจำเป็นต้องทำการ complie PHP รองรับการทำงานการเรียกใช้ LDAP
calls ก่อนที่จะเริ่มใช้งานได้ซึ่งเราอาจตรวจสอบว่า PHP engine ที่เราใช้งานอยู่รองรับการใช้งา
LDAP หรือเปล่าด้วย phpinfo() function
Purpose:
แนะนำการตัวอย่าง Program ในการติดต่อใช้งาน OiD จาก PHP program
Step-by-Step Example:
ในตัวอย่างนี้ เราจะกำหนดให้ Base dn ของ Server เป็น "dc=exzilla,dc=com"
และทำการติดต่อกับ OiD ด้วย anonymous user
The typical
sequence of LDAP
ldap_connect() // establish connection to server
|
ldap_bind() // anonymous or authenticated "login"
|
do something like search or update the directory
and display the results
|
ldap_close() // "logout"
|
Create PHP
Program and deploy to your webserver
เริ่มต้นจากการพัฒนา php Program และทำการ
Deploy ไปยัง Directory ที่เราต้องการ ซึ่งในตัวอยางเป็นการค้นหาข้อมูลที่
OiD server โดยค้นหาเฉพาะผู้ที่มีนามสกุลเป็น "graham"
( sn=graham)
Testing
Try to execute sample code from any browser
http://archer.exzilla.net/firstSearch.php
|
Sample Output
LDAP query for exzilla.com
Connecting ...connect result is 1
Binding ...Bind result is 1
Searching for (sn=graham) ...Search result is 2
Number of entires returned is 2
Getting entries ...
Data for 2 items returned:
dn is: uid=fuju@exzilla.com, o=SALES,dc=exzilla,dc=com
first cn entry is: Fuju Graham
first email entry is:
Title entry is: Sales Manager
dn is: mail=teddy@exzilla.net, o=SALES,dc=exzilla,dc=com
first cn entry is: Teddy Graham
first email entry is: teddy@exzilla.net
Title entry is: Presales
Closing connection
|
Note:
Complete
Sample code:
download
References:
1.Oracle Internet Directory Application
Developers Guide, Release 2.1.1
Part ,No. A86082-01
2. http://www.php.net/manual/en/ref.ldap.php
More Information:
1.Oracle Internet Directory Application
Developers Guide, Release 2.1.1
Part ,No. A86082-01
2.$ORACLE_HOME/ldap/demo/plsql/search.sql
sample program.
3.http://www.openldap.org/
4.http://www.redhat.com/
-> ldap documents.
5.http://www.php.net/
Keywords:
ldap oid ldap php search oid oracle api php
|