unifi-check.pl: replace URL::Encode with HTTP::Message

the former isn't available in Debian.
unifi-check.pl: refactor common unifi API calls