8
8
9
9
<refsect1 role =" description" >
10
10
&reftitle.description;
11
+ <methodsynopsis >
12
+ <type >resource</type ><methodname >ldap_connect</methodname >
13
+ <methodparam choice =" opt" ><type >string</type ><parameter >ldap_uri</parameter ><initializer >&null; </initializer ></methodparam >
14
+ </methodsynopsis >
15
+ <warning >
16
+ <simpara >
17
+ The <emphasis >following</emphasis > signature is still supported for backwards
18
+ compatibility, but is considered deprecated and should not be used anymore!
19
+ </simpara >
20
+ </warning >
11
21
<methodsynopsis >
12
22
<type >resource</type ><methodname >ldap_connect</methodname >
13
23
<methodparam choice =" opt" ><type >string</type ><parameter >host</parameter ><initializer >&null; </initializer ></methodparam >
31
41
<para >
32
42
<variablelist >
33
43
<varlistentry >
34
- <term ><parameter >host </parameter ></term >
44
+ <term ><parameter >ldap_uri </parameter ></term >
35
45
<listitem >
36
46
<para >
37
- This field supports using a hostname or, with OpenLDAP 2.x.x and
38
- later, a full LDAP URI of the form <literal >ldap://hostname:port</literal >
47
+ A full LDAP URI of the form <literal >ldap://hostname:port</literal >
39
48
or <literal >ldaps://hostname:port</literal > for SSL encryption.
40
49
</para >
41
50
<para >
46
55
</para >
47
56
</listitem >
48
57
</varlistentry >
58
+ <varlistentry >
59
+ <term ><parameter >host</parameter ></term >
60
+ <listitem >
61
+ <para >
62
+ The hostname to connect to.
63
+ </para >
64
+ </listitem >
65
+ </varlistentry >
49
66
<varlistentry >
50
67
<term ><parameter >port</parameter ></term >
51
68
<listitem >
52
69
<para >
53
- The port to connect to. Not used when using LDAP URIs.
70
+ The port to connect to.
54
71
</para >
55
72
</listitem >
56
73
</varlistentry >
61
78
<refsect1 role =" returnvalues" >
62
79
&reftitle.returnvalues;
63
80
<para >
64
- Returns a positive LDAP link identifier when the provided hostname/port combination or LDAP URI
65
- seems plausible. It's a syntactic check of the provided parameters but the server(s) will not
81
+ Returns a positive LDAP link identifier when the provided LDAP URI
82
+ seems plausible. It's a syntactic check of the provided parameter but the server(s) will not
66
83
be contacted! If the syntactic check fails it returns &false; .
67
- When OpenLDAP 2.x.x is used, <function >ldap_connect</function > will always
84
+ <function >ldap_connect</function > will otherwise
68
85
return a <type >resource</type > as it does not actually connect but just
69
86
initializes the connecting parameters. The actual connect happens with
70
87
the next calls to ldap_* funcs, usually with
71
88
<function >ldap_bind</function >.
72
89
</para >
73
90
<para >
74
- If no arguments are specified then the link identifier of the already
91
+ If no argument is specified then the link identifier of the already
75
92
opened link will be returned.
76
93
</para >
77
94
</refsect1 >
86
103
<?php
87
104
88
105
// LDAP variables
89
- $ldaphost = "ldap.example.com"; // your ldap servers
90
- $ldapport = 389; // your ldap server's port number
106
+ $ldapuri = "ldap://ldap.example.com:389"; // your ldap-uri
91
107
92
108
// Connecting to LDAP
93
- $ldapconn = ldap_connect($ldaphost, $ldapport )
94
- or die("Could not connect to $ldaphost ");
109
+ $ldapconn = ldap_connect($ldapuri )
110
+ or die("That LDAP-URI was not parseable ");
95
111
96
112
?>
97
113
]]>
@@ -109,7 +125,7 @@ $ldaphost = "ldaps://ldap.example.com/";
109
125
110
126
// Connecting to LDAP
111
127
$ldapconn = ldap_connect($ldaphost)
112
- or die("Could not connect to {$ldaphost} ");
128
+ or die("That LDAP-URI was not parseable ");
113
129
114
130
?>
115
131
]]>
0 commit comments