in reply to POST API in Perl using LWP::UserAgent with authentication providing errors
2 problems I can see so far
1. your urlencode() is escaping dots. As hippo said use a module. See the difference
#!perl use strict; use URI::Escape; my $url = "https://www.cryptopia.co.nz/api/GetBalance"; print uri_escape($url)."\n"; print urlencode($url)."\n"; sub urlencode { my $s = shift; $s =~ s/ /+/g; $s =~ s/([^A-Za-z0-9\+-])/sprintf("%%%02X", ord($1))/seg; return $s; }
2. With MIME::Base64 encode_base64( $bytes ) by default adds line endings.
Try using encode_base64( $bytes,'' )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: POST API in Perl using LWP::UserAgent with authentication providing errors
by ssara (Acolyte) on Jan 20, 2018 at 13:48 UTC | |
by poj (Abbot) on Jan 20, 2018 at 14:24 UTC |