mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 13:58:55 +00:00
189 lines
5.4 KiB
XML
189 lines
5.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.ldap-connect" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>ldap_connect</refname>
|
|
<refpurpose>Connect to an LDAP server</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>LDAP\Connection</type><type>false</type></type><methodname>ldap_connect</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>uri</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<warning>
|
|
<simpara>
|
|
The <emphasis>following</emphasis> signature is still supported for backwards
|
|
compatibility (except for using named parameters), but is considered deprecated and should not be used anymore!
|
|
</simpara>
|
|
</warning>
|
|
<methodsynopsis>
|
|
<type class="union"><type>LDAP\Connection</type><type>false</type></type><methodname>ldap_connect</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>uri</parameter><initializer>&null;</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>389</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Creates an <classname>LDAP\Connection</classname> connection and checks whether the given
|
|
<parameter>uri</parameter> is plausible.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
This function does <emphasis>not</emphasis> open a connection.
|
|
It checks whether the given parameters are plausible and can be used
|
|
to open a connection as soon as one is needed.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>uri</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A full LDAP URI of the form <literal>ldap://hostname:port</literal>
|
|
or <literal>ldaps://hostname:port</literal> for SSL encryption.
|
|
</para>
|
|
<para>
|
|
You can also provide multiple LDAP-URIs separated by a space as one string
|
|
</para>
|
|
<para>
|
|
Note that <literal>hostname:port</literal> is not a supported LDAP URI as the schema is missing.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>uri</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The hostname to connect to.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>port</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The port to connect to.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns an <classname>LDAP\Connection</classname> instance when the provided LDAP URI
|
|
seems plausible. It's a syntactic check of the provided parameter but the server(s) will not
|
|
be contacted! If the syntactic check fails it returns &false;.
|
|
<function>ldap_connect</function> will otherwise
|
|
return a <classname>LDAP\Connection</classname> instance as it does not actually connect but just
|
|
initializes the connecting parameters. The actual connect happens with
|
|
the next calls to ldap_* functions, usually with
|
|
<function>ldap_bind</function>.
|
|
</para>
|
|
<para>
|
|
If no argument is specified then the <classname>LDAP\Connection</classname> instance of the already
|
|
opened connection will be returned.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.1.0</entry>
|
|
<entry>
|
|
Returns an <classname>LDAP\Connection</classname> instance now;
|
|
previously, a &resource; was returned.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Example of connecting to LDAP server.</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// LDAP variables
|
|
$ldapuri = "ldap://ldap.example.com:389"; // your ldap-uri
|
|
|
|
// Connecting to LDAP
|
|
$ldapconn = ldap_connect($ldapuri)
|
|
or die("That LDAP-URI was not parseable");
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Example of connecting securely to LDAP server.</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// make sure your host is the correct one
|
|
// that you issued your secure certificate to
|
|
$ldaphost = "ldaps://ldap.example.com/";
|
|
|
|
// Connecting to LDAP
|
|
$ldapconn = ldap_connect($ldaphost)
|
|
or die("That LDAP-URI was not parseable");
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>ldap_bind</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|