I think I’ve installed the isdk properly, but I consistently get an error after this code. I’m sure I’m missing a step that I’m not seeing -
Here’s an example of the code:
<?PHP
require("vendor/isdk.php");
require_once 'vendor/autoload.php';
$infusionsoft = new Infusionsoft\Infusionsoft(array(
'clientId' => 'ValidID',
'clientSecret' => 'ValidSecret',
'redirectUri' => 'MYURI',
));
$yourStoredToken="VALID TOKEN";
// retrieve the existing token object from storage
$infusionsoft->setToken($yourStoredToken);
$app = new iSDK();
// perform authorization tasks
$returnFields = array('Email', 'FirstName', 'LastName');
$conDat = $app->dsLoad("Contact", 123, $returnFields);
echo "".$conDat;
The error I get is:
Fatal error: Call to a member function send() on a non-object in /****etc/vendor/isdk.php on line 123
Your OAuth is assigned to the object $infusionsoft but your instantiating the app api key method without calling cfgCon method using $app, which is why you are seeing that error message. Pick one method or the other for authentication and only use that object.
and here’s the error I get:
Fatal error: Uncaught exception ‘Infusionsoft\TokenExpiredException’ in /IS/vendor/infusionsoft/php-sdk/src/Infusionsoft/Infusionsoft.php:385 Stack trace: #0 /IS/vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/ContactService.php(13): Infusionsoft\Infusionsoft->request(‘ContactService…’, Array) #1 /IS/ISTest7.php(22): Infusionsoft\Api\ContactService->add(Array) #2 {main} thrown in /IS/vendor/infusionsoft/php-sdk/src/Infusionsoft/Infusionsoft.php on line 385
Sure, but while oauth doesn’t require short time to live with the access token, Infusionsoft requires 24 hour renewal of the token to ensure PCI compliant apps…in short there are pros and cons to both.