Added Test Mode, Fixed unauthorized ugly error

Test Mode implements the test.bitpay.com/api, and allows the user to
switch between it and live mode.

If an incorrect API Key is used, PHP errors trying to log a string when
the server response is an array. The array is now converted to a string
first.