infusionsoft/PHP-iSDK — pull request #2 by innerbot (2012-11-26 00:58:51+00:00)
Title: Fixing connection validation

For those of us developing and maintaining apps connecting via iSDK::cfgCon() there has been a problem with the connection validation.

I'm not sure how long this issue has been present, but the last few lines of cfgCon() were testing against whether or not the $result variable contained the word "InvalidKey"

Assuming the only error a person could make is to use an invalid API key, that would be just fine. However, a person can (and I certainly have) make a mistake when typing out the application name, which will result in a 404 from curl. In this event, the cfgCon was still returning TRUE;

Das ist nicht goed.

I was originally going to write a custom test, but noticed the appEcho function. This test has proven to be much more dependable than the original test. Now, when a user types in a bad application name or API key, the cfgCon connection validation fails correctly.