I'm building an application that imports Basecamp data using their API and some PHP classes I've constructed. No problems there. However, since the app will be authenticating via the Basecamp API based on credentials the user enters, I won't always know if the Basecamp creds they use are correct. Right now my logic just assumes the creds are good and processes accordingly (which I have working flawlessly). If they aren't, the scripts error out.
What I'd like to do is be able to capture and process the response from the API, and give the user back a friendly error message if their creds failed for any reason (bad creds, wrong URL, Basecamp API access for the account not enabled, etc.) I don't really care what the culprit is, I just want to tell them it failed and that they can check on a few possible reasons.
According to the Basecamp API, "If a request fails, a non-200 status code will be returned"
I'm using CURL to send the creds and get back the XML from the API. Forgive me if this is something really simple--I'm a decent PHP programmer, but a bit of a noob when it comes to interfacing with APIs.