{
    "mode": "perldoc",
    "parameter": "LWP::Protocol::ldap",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/LWP%3A%3AProtocol%3A%3Aldap/json",
    "generated": "2026-06-13T21:35:18Z",
    "synopsis": "use LWP::UserAgent;\n$ua = LWP::UserAgent->new();\n$res = $ua->get('ldap://ldap.example.com/' .\n'o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)',\nAccept => 'text/json'):",
    "sections": {
        "NAME": {
            "content": "LWP::Protocol::ldap - Provide LDAP support for LWP::UserAgent\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use LWP::UserAgent;\n\n$ua = LWP::UserAgent->new();\n$res = $ua->get('ldap://ldap.example.com/' .\n'o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)',\nAccept => 'text/json'):\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The LWP::Protocol::ldap module provides support for using *ldap* schemed URLs following RFC 4516\nwith LWP. This module is a plug-in to the LWP protocol handling, so you don't use it directly.\n\nIn addition to being used with LDAP URIs, LWP::Protocol::ldap also acts as the base class for\nits sibling modules LWP::Protocol::ldaps and LWP::Protocol::ldapi.\n",
            "subsections": [
                {
                    "name": "Features",
                    "content": "HTTP methods supported\nLWP::Protocol::ldap implements the HTTP *GET* and *HEAD* methods. They are mapped to the LDAP\nsearch operation,\n\nResponse format\nDepending on the HTTP *Accept* header provided by the user agent, LWP::Protocol::ldap can answer\nthe requests in one of the following formats:\n\nDSML\nWhen the HTTP *Accept* header contains the \"text/dsml\" MIME type, the response is sent as\nDSMLv1.\n\nJSON\nWhen the HTTP *Accept* header contains the \"text/json\" MIME type, the response is sent as\nJSON. For this to work the *JSON* Perl module needs to be installed.\n\nLDIF\nWhen the HTTP *Accept* header contains the \"text/ldif\" MIME type, the response is sent in\nLDIFv1 format.\n\nHTML\nIn case no HTTP *Accept* header has been sent or none of the above MIME types can be\ndetected, and the *x-format* extension has not been provided either, the response is sent\nusing HTML markup in a 2-column table format (roughly modeled on LDIF).\n\nAs an alternative to sending an HTTP *Accept* header, LWP::Protocol::ldap also accepts the\n\"x-format\" extension\n\nExample:\n\nldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-format=dsml\n\nTLS support\nFor *ldap* and *ldapi* URIs, the module implements the \"x-tls\" extension that switches the LDAP\nconnection to TLS using a call of the starttls method.\n\nExample:\n\nldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-tls=1\n\nNote: In the above example, ideally giving \"x-tls\" should be sufficient, but unfortunately the\nparser in URI::ldap has a little flaw.\n\nAuthorization\nUsually the connection is done anonymously, but if the HTTP *Authorization* header is provided\nwith credentials for HTTP Basic authorization, the credentials given in that header will be used\nto do a simple bind to the LDAP server.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "LWP::Protocol::ldaps, LWP::Protocol::ldapi\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 1998-2004 Graham Barr, 2012 Peter Marschall. All rights reserved. This program is\nfree software; you can redistribute it and/or modify it under the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "LWP::Protocol::ldap - Provide LDAP support for LWP::UserAgent",
    "flags": [],
    "examples": [],
    "see_also": []
}