Can anyone point to some sample code for that using PHP SDK?
Assuming you don’t mean using the PHP SDK, you can easily do it using cURL. The PAT/SAK is one of the param values in the code examples in the XML docs. There are a few things (so far) in my updating from the legacy code to the new APIs where the only option was using the XML-RPC API because what I needed to do wasn’t available in REST v1 or REST v2 (such as searching via a custom field, sending an email or running an action set).
@Bill_Jenkins if you’re referring to the XMLRPC API SDK, I refactored the original iSDK and provided a link from my dropbox account, you can find that and more information in the Legacy Key Sunsetting thread:
I’m looking for the following code revised to use PAT or SAK
require_once ‘…/vendor/autoload.php’;
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
‘clientId’ => ‘’,
‘clientSecret’ => ‘’,
‘redirectUri’ => ‘’,
));
// If the serialized token is available in the session storage, we tell the SDK
// to use that token for subsequent requests.
if (isset($_SESSION[‘token’])) {
$infusionsoft->setToken(unserialize($_SESSION[‘token’]));
}
This should be what you’re looking for then:
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
'apikey' => 'SAK_GOES_HERE',
));
But this doesn’t use the OAuth so you won’t need the session token code.
This information is document on the Github Repo:
I’m using it but getting the following error.
PHP Fatal error: Uncaught iSDKException: ERROR: 5 - Didn’t receive 200 OK from remote server
What version of PHP is running on your server? Looks like it needs to be PHP 8.1.
As of version 1.6, PHP 8.1+ is required.
I’m using the PHP 8.2
I’m not getting this error continuously, script is working after refresh the page.