.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "cPanel::PublicAPI 3" .TH cPanel::PublicAPI 3 "2019-11-06" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" cPanel::PublicAPI \- A perl interface for interacting with cPanel .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use cPanel::PublicAPI; \& \& # Auto detect authentication information \& my $cp = cPanel::PublicAPI\->new(); \& # or specify a user/password \& my $cp = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqsomeuser\*(Aq, \*(Aqpass\*(Aq => \*(Aqsomepass\*(Aq ); \& # or specify an accesshash \& my $cp = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqsomeuser\*(Aq, \*(Aqaccesshash\*(Aq => $accesshash ); \& # or specify an API token \& my $cp = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqsomeuser\*(Aq, \*(Aqapi_token\*(Aq => $api_token ); \& \& # Perform an xml\-api query \& $cp\->whm_api(\*(Aqlistaccts\*(Aq); \& # Pass parameters to the xml\-api \& $cp\->whm_api(\*(Aqcreateacct\*(Aq, {\*(Aqusername\*(Aq => \*(Aqsomeuser\*(Aq, \*(Aqpassword\*(Aq => \*(Aqs0m3P4$$w()Rd\*(Aq } ); \& # Return JSON from xml\-api (rather than a hash reference) \& $cp\->whm_api(\*(Aqversion\*(Aq, undef, \*(Aqjson\*(Aq); \& \& # Perform an API2 query \& $cp\->cpanel_api2_request(\*(Aqwhostmgr\*(Aq, \& { \& \*(Aqmodule\*(Aq => \*(AqEmail\*(Aq, \& \*(Aqfunc\*(Aq => \*(Aqlistpopswithdisk\*(Aq, \& \*(Aquser\*(Aq => \*(Aqsomeuser\*(Aq, \& } \& ); \& # Perform an API2 query when authenticated as a user \& $cp\->cpanel_api2_request(\*(Aqcpanel\*(Aq, \& { \& \*(Aqmodule\*(Aq => \*(AqEmail\*(Aq, \& \*(Aqfunc\*(Aq => \*(Aqlistpopswithdisk\*(Aq, \& } \& ); \& # Pass parameters to an API2 call \& $cp\->cpanel_api2_request(\*(Aqcpanel\*(Aq \& { \& \*(Aqmodule\*(Aq => \*(AqEmail\*(Aq, \& \*(Aqfunc\*(Aq => \*(Aqaddpop\*(Aq, \& }, \& { \& \*(Aqdomain\*(Aq => \*(Aqdomain.com\*(Aq, \& \*(Aqemail\*(Aq => \*(Aqusername\*(Aq, \& \*(Aqpassword\*(Aq => \*(AqSojmASDM(#(Jinasifodanosd\*(Aq, \& \*(Aqquota\*(Aq => 200 \& }, \& ); \& \& # Perform an API1 query \& $cp\->cpanel_api1_request(\*(Aqwhostmgr\*(Aq, \& { \& \*(Aqmodule\*(Aq => \*(AqLastLogin\*(Aq, \& \*(Aqfunc\*(Aq => \*(Aqlastlogin\*(Aq, \& \*(Aquser\*(Aq => \*(Aqsomeuser\*(Aq \& } \& ); \& # Pass parameters to an API1 query \& $cp\->cpanel_api1_request(\*(Aqcpanel\*(Aq, \& { \& \*(Aqmodule\*(Aq => \*(AqMysql\*(Aq, \& \*(Aqfunc\*(Aq => \*(Aqadduserdb\*(Aq, \& }, \& [ \*(Aqsomedb\*(Aq, \*(Aqsomedbuser\*(Aq, \*(AqALL\*(Aq ] \& ); \& \& # perform an HTTP GET request against a URL \& $cp\->api_request(\*(Aqwhostmgr\*(Aq, \*(Aq/xml\-api/loadavg\*(Aq, \*(AqGET\*(Aq); \& \& # perform an HTTP GET request with parameters \& $cp\->api_request(\*(Aqwhostmgr\*(Aq, \*(Aq/xml\-api/createacct\*(Aq, \*(AqGET\*(Aq, {\*(Aqusername\*(Aq => \*(Aqsomeuser\*(Aq, domain => \*(Aqdomain.com\*(Aq} ); \& \& # perform an HTTP POST request (with parameters) \& $cp\->api_request(\*(Aqwhostmgr\*(Aq, \*(Aq/xml\-api/createacct\*(Aq, \*(AqPOST\*(Aq, {\*(Aqusername\*(Aq => \*(Aqsomeuser\*(Aq, domain => \*(Aqdomain.com\*(Aq} ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" cPanel::PublicAPI is a supported interface for interacting with cPanel's APIs over \s-1HTTP.\s0 This allows you to query either \s-1WHM\s0 or cPanel accounts from a perl interface. The purpose of this module is to provide an easy-to-use interface into cPanel's various APIs without requiring much knowledge of how they work. .SS "Object Construction" .IX Subsection "Object Construction" a cPanel::PublicAPI object is constructed with the \fInew()\fR method. .PP .Vb 1 \& my $publicapi = cPanel::PublicAPI\->new(); .Ve .PP When passed no parameters, this will create the object using the accesshash in ~/.accesshash. If no .accesshash file exists, it will attempt to use the \s-1REMOTE_PASS\s0 environment variable. If the \s-1REMOTE_PASS\s0 variable is not defined, object creation will error out. .PP \fI\fInew()\fI parameters\fR .IX Subsection "new() parameters" .PP options for \fInew()\fR are specified as a hash reference, the following parameters are supported: .IP "\(bu" 4 user \- The username to authenticate as. .IP "\(bu" 4 pass \- The password to use for authentication. .IP "\(bu" 4 accesshash \- The accesshash to use for authentication (\s-1WHM\s0 only). .IP "\(bu" 4 api_token \- The \s-1API\s0 token to use for authentication. .IP "\(bu" 4 timeout \- The length of time (in seconds) before an http request should time out. Default to 300. .IP "\(bu" 4 ip \- The \s-1IP\s0 to be queried. defaults to 127.0.0.1, if host is defined it will take precedence over the 'ip' parameter. .IP "\(bu" 4 host \- The hostname to be queried. This will take precedence over the 'ip' parameter. .IP "\(bu" 4 usessl \- 1 or 0, Indicates whether communication should be performed over \s-1SSL\s0 or not (default to 1). .IP "\(bu" 4 ssl_verify_mode \- 1 or 0, Indicates whether to verify \s-1SSL\s0 certificates or not. (default to 1). .IP "\(bu" 4 error_log \- Path to where you want debug and error logging information to be written to. If this is not defined or the module is unable to open the path in question, it will default to \s-1STDERR.\s0 .IP "\(bu" 4 debug \- Enables debug logging, which will place considerably more information into the error_log. .IP "\(bu" 4 http_tiny_creator \- An optional code reference that receives the list of key/value pairs that normally goes into HTTP::Tiny’s constructor to create an instance of that class for this module’s internal use. The code reference, when called, should return an object that implements an HTTP::Tiny\-compatible interface. .Sp This parameter is useful for customizing that internal HTTP::Tiny instance that cPanel::PublicAPI uses. Handle with care, though: this parameter may break cPanel::PublicAPI in various ways—some subtle, others less so. .Sp For example, if you want a custom User-Agent header, you might do: .Sp .Vb 6 \& http_tiny_creator => sub { \& return HTTP::Tiny\->new( \& @_, \& agent => \*(AqMy Custom UA String\*(Aq, \& ); \& }, .Ve .PP \fIAuthentication methods\fR .IX Subsection "Authentication methods" .PP This module supports three authentication methods: .IP "1. Username & Password" 4 .IX Item "1. Username & Password" .Vb 2 \& use cPanel::PublicAPI; \& my $pubapi = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqpass\*(Aq => \*(Aqbar\*(Aq ); .Ve .IP "2. \s-1API\s0 Token" 4 .IX Item "2. API Token" (Note: This method does not work with Webmail.) .Sp To create an \s-1API\s0 token, visit \*(L"Manage \s-1API\s0 Tokens\*(R" in cPanel or \s-1WHM,\s0 and follow the appropriate prompts. Your token will appear in a special notice. Make certain that you save your \s-1API\s0 token in a safe location, as this is the only time the token will be shown to you. .Sp To use an \s-1API\s0 token with this module, do the following: .Sp .Vb 2 \& use cPanel::PublicAPI; \& my $pubapi = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqapi_token\*(Aq => $string_containing_api_token ); .Ve .IP "3. \s-1WHM\s0 Access Hash" 4 .IX Item "3. WHM Access Hash" \&\fB\s-1NOTE:\s0\fR Accesshash authentication is deprecated as of cPanel & \s-1WHM\s0 version 64. .Sp To configure accesshashes, you can either: .RS 4 .IP "\(bu" 4 In cPanel & \s-1WHM\s0 version 66 and earlier, visit “Setup remote access key” in \s-1WHM\s0 which will generate an accesshash for your server if one does not already exist. .IP "\(bu" 4 Run \fI/usr/local/cpanel/bin/mkaccesshash\fR. This will overwrite any existing access hash. .RE .RS 4 .Sp The generated accesshash is stored in \fI~/.accesshash\fR. .Sp To use an accesshash with this module, do the following: .Sp .Vb 2 \& use cPanel::PublicAPI; \& my $pubapi = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqaccesshash\*(Aq => $string_containing_access_hash ); .Ve .Sp It should be noted that the accesshash can contain newlines in it. Newlines will be stripped by the object when it attempts to perform a query. .RE .PP \fIDependencies\fR .IX Subsection "Dependencies" .PP This module will fall back on different modules if one fails to load. This allows for compatibility with cPanel & \s-1WHM\s0's internal perl parser and maintain compatibility with a standard perl implementation. The order that it will fall back on serialization modules is: .IP "\(bu" 4 JSON::Syck .IP "\(bu" 4 \&\s-1JSON\s0 .IP "\(bu" 4 \&\s-1JSON::XS\s0 .IP "\(bu" 4 \&\s-1JSON::PP\s0 .PP If you installed this module via \s-1CPAN,\s0 this should never be an issue. If you are wishing to use this module on a system where you do not have access to compiled modules, \s-1JSON::PP\s0 is the recommended serializer. .SH "Two-Factor Authentication (2FA)" .IX Header "Two-Factor Authentication (2FA)" cPanel version 54 and above allows users to configure 2FA on their accounts \- this security policy requires that the \s-1API\s0 queries are performed after authenticating and establishing a session. The workflow to accomodate 2FA will be as so: .PP .Vb 1 \& use cPanel::PublicAPI; \& \& use lib \*(Aq/usr/local/cpanel\*(Aq; \& use Cpanel::Security::Authn::TwoFactorAuth::Google (); # only available in 11.54+ \& \& my $pubapi = cPanel::PublicAPI\->new( \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqpass\*(Aq => \*(Aqbar\*(Aq ); \& my $google_auth = Cpanel::Security::Authn::TwoFactorAuth::Google\->new( \& { \& \*(Aqaccount_name\*(Aq => \*(Aqfoo\*(Aq, \& \*(Aqsecret\*(Aq => $user_2fa_secret, \& \*(Aqissuer\*(Aq => \*(Aq\*(Aq \& } \& ); \& $pubapi\->establish_tfa_session(\*(Aqwhostmgr\*(Aq, $google_auth\->generate_code()); \& $pubapi\->whm_api(\*(Aqapplist\*(Aq); .Ve .PP Anytime you change services (e.g. from 'whostmgr' to 'cpanel'), you must establish the 2FA session for the new service. .PP .Vb 4 \& eval { \& $pubapi\->cpanel_api2_request(\*(Aqcpanel\*(Aq, { \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqmodule\*(Aq => \*(AqMysqlFE\*(Aq, \*(Aqfunc\*(Aq => \*(Aqlistdbs\*(Aq }, {} ); \& }; \& print "failed cause 2fa session wasn\*(Aqt established\en" if $@; \& \& $pubapi\->establish_tfa_session(\*(Aqcpanel\*(Aq, $google_auth\->generate_code()); \& eval { \& $pubapi\->cpanel_api2_request(\*(Aqcpanel\*(Aq, { \*(Aquser\*(Aq => \*(Aqfoo\*(Aq, \*(Aqmodule\*(Aq => \*(AqMysqlFE\*(Aq, \*(Aqfunc\*(Aq => \*(Aqlistdbs\*(Aq }, {} ); \& }; \& print "success\en" if not $@; .Ve .PP \&\fB\s-1NOTE\s0\fR: Additionally, since accesshash authentication is not allowed to establish sessions, you must use the 'user'/'pass' authentication in order to make \s-1API\s0 requests as a user with 2FA configured. .SH "Important Methods" .IX Header "Important Methods" .SS "Querying the xml-api \- \fIwhm_api()\fP" .IX Subsection "Querying the xml-api - whm_api()" The XML-API is \s-1WHM\s0's \s-1API\s0 used for administrative functions is handled via the \fIwhm_api()\fR method. .PP The syntax for whmapi is: .PP .Vb 1 \& $cp\->whm_api($call [, \e%formdata, $format ] ); .Ve .PP The meaning of these parameters is: .IP "\(bu" 4 \&\f(CW$call\fR \- The XML-API call you wish to query .IP "\(bu" 4 \&\f(CW$formdata\fR \- The parameters for the XML-API call in question, f.ex. for suspendacct, here you would pass in a hashref containing “user” and “reason”. If there are no parameters, this can be undef or a blank hash. .IP "\(bu" 4 \&\f(CW$format\fR \- The requested response format. The valid values here are “xml”, “json” or “ref” (perl hash reference). This will default to returning a perl hash reference when the value is undef. .PP By default, \s-1WHM API\s0 v1 is used. If, for legacy reasons, you need to use v0, please set the \f(CW\*(C`api.version\*(C'\fR key to 0 in the formdata parameter. .PP For more information on what calls are available and how they can be referenced, please see the xml-api documentation at . .SS "Querying cPanel's APIs" .IX Subsection "Querying cPanel's APIs" cPanel supports two APIs, designated \*(L"\s-1API1\*(R"\s0 and \*(L"\s-1API2\*(R".\s0 .PP cPanel \s-1API\s0 calls are seperate into Modules, these module names relate to modules within the Cpanel namespace on a cPanel server. Each module defines a set of functions that are from either \s-1API1\s0 or \s-1API2 \s0(or both). .PP There are two distinct differences between \s-1API1\s0 and \s-1API2:\s0 .IP "\(bu" 4 \&\s-1API1\s0 Takes in ordered parameters and returns strings .IP "\(bu" 4 \&\s-1API2\s0 uses named parameters and returns hashes or arrays of hashes .PP Within the context of the public api, calling a function from \s-1API1\s0 or \s-1API2\s0 will always return a hash, but the specific data returned from the \s-1API\s0 call will be contained within the 'data' key of the response. .PP For more information on the differences between \s-1API1\s0 and \s-1API2\s0 please see the documentation: .PP For information on calling \s-1API1\s0 and \s-1API2\s0 direct via \s-1HTTP,\s0 please see: .PP \fI\fIcpanel_api1_request()\fI\fR .IX Subsection "cpanel_api1_request()" .PP \&\f(CW\*(C`cpanel_api1_request()\*(C'\fR is used to query cPanel's \s-1API1,\s0 the function used for querying \s-1API1\s0 has the following syntax: .PP .Vb 1 \& $cp\->cpanel_api1_request($service, \e%cfg [, \e@params, $format ] ); .Ve .IP "\(bu" 4 \&\f(CW$service\fR \- The service that you wish to query. This can be 'cpanel' 'whostmgr', or 'webmail'. It is important to note that what services you are able to query depends on the user you are authenticated as. Only a user with reseller or root access can use the whostmgr service. If you are authenticated as root, you will not be able to query the 'cpanel' service. When the service is set to 'whostmgr' a 'user' must be set in the \f(CW$cfg\fR hash. .IP "\(bu" 4 \&\f(CW$cfg\fR \- A hash reference describing the call you wish to make. Required parameters are 'module' and 'func', which correspond to the module and function of the \s-1API\s0 call you wish to query. If you are querying the \*(L"whostmgr\*(R" service, you will need to specify 'user' as well. .IP "\(bu" 4 \&\f(CW$params\fR \- An array reference containing the parameters you wish to pass to the \s-1API\s0 call. .IP "\(bu" 4 \&\f(CW$format\fR \- The format for the xml-api to respond in. The valid values here are “xml”, “json” or “ref” (perl hash reference). This will default to returning a perl hash reference. .PP To see what modules and functions are available for making \s-1API1\s0 calls, please see: .PP \fI\fIcpanel_api2_request()\fI\fR .IX Subsection "cpanel_api2_request()" .PP \&\f(CW\*(C`cpanel_api2_request()\*(C'\fR is used to query cPanel's \s-1API2,\s0 the function use for querying \s-1API2\s0 has the following syntax: .PP .Vb 1 \& $cp\->cpanel_api2_request( $service, \e%cfg [, \e%params, $format ] ); .Ve .IP "\(bu" 4 \&\f(CW$service\fR \- The service that you wish to query. This can be 'cpanel' 'whostmgr', or 'webmail'. It is important to note that what services you are able to query depends on the user you are authenticated as. A user that does not have reseller or root access will not be able to use the whostmgr service. If you are authenticated as root, you will not be able to query the 'cpanel' service. When the service is set to 'whostmgr' a 'user' must be set in the \f(CW$cfg\fR hash. .IP "\(bu" 4 \&\f(CW$cfg\fR \- A hash reference describing the call you wish to make. required parameters here are 'module' and 'func', which correspond to the module and function of the \s-1API\s0 call you wish to query. If you are querying the \*(L"whostmgr\*(R" service, you will need to specify 'user' as well. .IP "\(bu" 4 \&\f(CW$params\fR \- An hash reference containing the parameters you wish to pass to the \s-1API\s0 call. .IP "\(bu" 4 \&\f(CW$format\fR \- The format for the xml-api to respond in. The valid values here are “xml”, “json” or “ref” (perl hash reference). This will default to returning a perl hash reference when the value is undef. .PP To see what modules and functions are available for making \s-1API2\s0 calls, please see: .SS "\fIapi_request()\fP \- Making direct \s-1URL\s0 requests to cPanel & \s-1WHM.\s0" .IX Subsection "api_request() - Making direct URL requests to cPanel & WHM." There are some situations where you will need to query cPanel and \s-1WHM\s0 URLs directly. This should \s-1ONLY\s0 be done when there is not an \s-1API\s0 call available for the function you wish to query. .PP The function used for querying URLs directly is \fIapi_request()\fR. It will always return a string rather than converting the response into a hash reference. It uses the following syntax: .PP .Vb 1 \& $cp\->api_request( $service, $uri, $method, \e%formdata, $headers) .Ve .IP "\(bu" 4 \&\f(CW$service\fR \- The service that you wish to query. This can be 'cpanel' 'whostmgr', or 'webmail', when passed an numerical value, PublicAPI will query that port directly. .IP "\(bu" 4 \&\f(CW$uri\fR \- The \s-1URL\s0 you wish to query, e.g. '/xml\-api/cpanel' .IP "\(bu" 4 \&\f(CW$method\fR \- '\s-1GET\s0' or '\s-1POST\s0' .IP "\(bu" 4 \&\f(CW$formdata\fR \- The data you wish to pass to the \s-1URL\s0 .IP "\(bu" 4 \&\f(CW$headers\fR \- Any additional headers are to be passed with the request. These can be either a flat string or as a hashref like {'headertitle' => 'headerdata'} .SH "Other Features" .IX Header "Other Features" .ie n .IP """establish_tfa_session()""" 4 .el .IP "\f(CWestablish_tfa_session()\fR" 4 .IX Item "establish_tfa_session()" .PP See \*(L"Two-Factor Authentication (2FA)\*(R" above. .ie n .IP """set_debug()""" 4 .el .IP "\f(CWset_debug()\fR" 4 .IX Item "set_debug()" .PP This function allows you to enable/disable debug mode by passing a value that evaluates to 'true' or 'false'. .ie n .IP """user()""" 4 .el .IP "\f(CWuser()\fR" 4 .IX Item "user()" .PP Allows you to change the user that your PublicAPI object is authenticating with. .ie n .IP """pass()""" 4 .el .IP "\f(CWpass()\fR" 4 .IX Item "pass()" .PP Allows you to change the password that your PublicAPI object is authenticating with, this will remove the stored accesshash from the object. .ie n .IP """accesshash()""" 4 .el .IP "\f(CWaccesshash()\fR" 4 .IX Item "accesshash()" .PP Allows you to change the accesshash that your PublicAPI object is authenticating with, this will remove the stored password from the object. .ie n .IP """api_token()""" 4 .el .IP "\f(CWapi_token()\fR" 4 .IX Item "api_token()" .PP Allows you to change the \s-1API\s0 token that your PublicAPI object is authenticating with, this will remove the stored password from the object. .ie n .IP """format_http_query()""" 4 .el .IP "\f(CWformat_http_query()\fR" 4 .IX Item "format_http_query()" .PP Allows you to construct formdata for an http query from a hash. For Example: .PP .Vb 1 \& $pubapi\->format_http_query( { \*(Aqone\*(Aq => \*(Aq1\*(Aq, \*(Aqtwo\*(Aq => 2 } ); .Ve .PP would return: .PP .Vb 1 \& \*(Aqone=1&two=2\*(Aq .Ve .ie n .IP """format_http_headers()""" 4 .el .IP "\f(CWformat_http_headers()\fR" 4 .IX Item "format_http_headers()" .PP Allows you to construct headers for an http query from a hash. For Example: .PP .Vb 1 \& $pubapi\->format_http_headers( { \*(AqAuthorization\*(Aq => \*(AqBasic cm9vdDpsMGx1cnNtNHJ0IQ==\*(Aq} ); .Ve .PP would return: .PP .Vb 1 \& \*(AqAuthorization: Basic cm9vdDpsMGx1cnNtNHJ0IQ==\er\en\*(Aq .Ve .ie n .IP """$pubapi\->{\*(Aqerror\*(Aq}""" 4 .el .IP "\f(CW$pubapi\->{\*(Aqerror\*(Aq}\fR" 4 .IX Item "$pubapi->{error}" .PP Errors encountered within the class are stored here before being written out to the error_fh filehandle. This can be used for checking the existance of query errors. .SH "Bugs" .IX Header "Bugs" see http://rt.cpan.org to report and view bugs .SH "License" .IX Header "License" Copyright (c) 2015, cPanel, Inc. All rights reserved. http://cpanel.net .PP Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of cPanel, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \*(L"AS IS\*(R" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \&\s0(\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \&\s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \&\s0(\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0