=head1 NAME

cPanel::PublicAPI::WHM - Legacy interface for querying WHM.

NOTE: This module is provided for legacy purposes, L<cPanel::PublicAPI> should be used instead

=head1 DESCRIPTION

This module provides legacy compatibility support between L<cPanel::PublicAPI> and Cpanel::Accounting (distributed with cPanel).
This should never be used unless there is a very good reason to use it (such as having a script that uses Cpanel::Accounting).

=head1 functions

=head2 C<simple_get_whmreq()>

This function makes a HTTP GET query to WHM, an equivalent function within L<cPanel::PublicAPI> is C<api_request()>.
This function uses two arrays to specify arguments to be passed to a specific URI.
This means that you would need to ensure that they both have the key/pair values in the same place in each array, f.ex:

  $argref = ['value1', 'value2', 'value3'];
  $argnameref = ['key1', 'key2', 'key3'];

would be be specifying:

  key1=value1&key2=value2&key3=value3

to be passed to the specified URI.

Arguments

=over

=item * $uri - The URI you to be queried.

=item * $argref - An array reference containing the values to be passed.

=item * $argnameref - An array reference containing the keys to be passed.

=item * $opts - An array reference containing strings like 'key1=value1' to be passed to the URI.

=back

This will return a scalar reference of the data returned by cpsrvd.

=head2 C<simple_post_whmreq()>

This function makes a HTTP POST query to WHM, an equivalent function within L<cPanel::PublicAPI> is C<api_request()>.
This function uses two arrays to specify arguments to be passed to a specific URI.
This means that you would need to ensure that they both have the key/pair values in the same place in each array, f.ex:

  $argref = ['value1', 'value2', 'value3'];
  $argnameref = ['key1', 'key2', 'key3'];

would be be specifying:

  key1=value1&key2=value2&key3=value3

to be passed to the specified URI.

Arguments

=over

=item * $uri - The URI you to be queried.

=item * $argref - An array reference containing the values to be passed.

=item * $argnameref - An array reference containing the keys to be passed.

=item * $opts - An array reference containing strings like 'key1=value1' to be passed to the URI.

=back

This will return a scalar containing the data returned by cpsrvd.

=head2 C<whmreq()>

This function is used to querying WHM with either GET or POST data.

=over

=item * $uri - The URI to be queried.

=item * $method - The method of querying the URI (either GET or POST).

=item * $formdata - The data to be passed to the URI formatted as formdata (e.g. 'key1=value1&key2=value2').

=back

=head2 C<api1()>

This function is used to query cPanel's API1.  This will return the XML response from the XML API's cpanel call.

=over

=item * $user - The user to execute an API call for.

=item * $module - The module of the API call to be executed.

=item * $func - The name of the API call to be executed.

=item * @params - An array containing the parameters for the API call.

=back

=head2 C<api2()>

This function is used to query cPanel's API1.  This will return the XML response from the XML API's cpanel call.

=over

=item * $user - The user to execute an API call for.

=item * $module - The module of the API call to be executed.

=item * $func - The name of the API call to be executed.

=item * %params - An hash containing the parameters for the API call.

=back

=head1 Bugs

see http://rt.cpan.org to report and view bugs

=head1 License

Copyright (c) 2015, cPanel, Inc.
All rights reserved.
http://cpanel.net

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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 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
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
