API-Intis

 view release on metacpan or  search on metacpan

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

    my $request_json; my $request_xml;
    foreach my $format (@o_formats) {
        $config{return} = $format;
        my $signature = &build_signature(%config);
        my $url = "$config{host}$method.php?login=$config{login}&signature=$signature";
        while((my $key, my $value) = each %config){
            say "$key => $value\n";
            next if $key eq 'host' || $key eq 'login' || $key eq 'APIkey';
            $url .= "&$key=$value";
        };
        my $request = $ua->get("$url&return=$format")->decoded_content(charset => 'utf-8', raw => 1);
        $request_json = $request if $format eq 'json';
        $request_xml = $request if $format eq 'xml';
    };
    my $r = from_json($request_json);
    my @error;
    if ($r->{error}) {
        @error = &error_codes::get_name_from_code($r->{error});
    } else {
        @error = &error_codes::get_name_from_code();
    };



( run in 1.546 second using v1.01-cache-2.11-cpan-49f99fa48dc )