API-Plesk

 view release on metacpan or  search on metacpan

lib/API/Plesk.pm  view on Meta::CPAN

    );
}

sub bulk_send { confess "Not implemented!" }

# Send xml request to plesk api
sub xml_http_req {
    my ($self, $xml) = @_;

    # HTTP::Request undestends only bytes
    utf8::encode($xml) if utf8::is_utf8($xml);

    my $ua = new LWP::UserAgent( parse_head => 0 );
    my $req = new HTTP::Request POST => $self->{url};

    if ($self->{secret_key}) {
        $req->push_header(':KEY',  $self->{secret_key});
    } else {
        $req->push_header(':HTTP_AUTH_LOGIN',  $self->{username});
        $req->push_header(':HTTP_AUTH_PASSWD', $self->{password});
    }

t/TestData.pm  view on Meta::CPAN


    return $result_hash;
}


sub check_input_data {
    my $params = shift;
    my $plesk_client = shift;

    my $general_info = {
        pname   => $params->{pname},  # utf8 string 
        login   => $params->{login},
        passwd  => $params->{passwd},
        phone   => $params->{phone},
        email   => $params->{email},
        country => $params->{country}, # optional field
    };
    

    my $result_add_by_id = $plesk_client->Accounts->create( 
        general_info    => $general_info,

t/response.t  view on Meta::CPAN

        operation => 'get',
        response  => {}
    ),
    'API::Plesk::Response'
);

my $res = API::Plesk::Response->new(
        operator  => 'customer',
        operation => 'get',
        response  => xml2hash('
<?xml version="1.0" encoding="utf-8"?>
<packet>
    <customer>
        <get>
            <result>
                <status>ok</status>
                <id>123</id>
                <guid>123456</guid>
                <data>
                    <test>qwerty</test>
                </data>



( run in 0.344 second using v1.01-cache-2.11-cpan-4d50c553e7e )