refactored to use curl; refactored to no longer use digest; no more header handling; no more session or cookie handling; better error handling for parsed responses