PHP Fata error all of a sudden?

I have a script that syncs with infusionsoft every night. was working fine for like 6 months. then all of a sudden on Sept 5 it broke. I now get the following. Can someone tell me why? What exactly did infusionsoft change to screw up my script?

Fatal error: Uncaught exception 'Infusionsoft\Http\HttpException' with message 'exception 'fXmlRpc\Exception\ResponseException' with message '[RecordNotFound]Record was not found' in //path//vendor/lstrojny/fxmlrpc/src/fXmlRpc/Exception/ResponseException.php:32
Stack trace:
#0 /path/vendor/lstrojny/fxmlrpc/src/fXmlRpc/Client.php(157): fXmlRpc\Exception\ResponseException::fault(Array)
#1 /path/vendor/infusionsoft/php-sdk/src/Infusionsoft/Http/InfusionsoftSerializer.php(28): fXmlRpc\Client->call('ContactService....', Array)
#2 /path/vendor/infusionsoft/php-sdk/src/Infusionsoft/Infusionsoft.php(404): Infusionsoft\Http\InfusionsoftSerializer->request('ContactService....', 'https://api.inf...', Array, Object(Infusionsoft\Http\GuzzleHttpClient))
#3 /path/vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/ContactService.php(73): Infusionsoft\Infu in //path//vendor/infusionsoft/php-sdk/src/Infusionsoft/Http/InfusionsoftSerializer.php on line 34

Hi @Bonnie_Ruddock, can you provide the snippet of code that is throwing this exception? It seems like you’re trying to do an operation on a contact that no longer exists but I’m not sure without seeing the code.

yes, your right, I’m trying to read a contact that does not exist I think. is there some example PHP code that will capture these fatal errors and not throw them?

Hi, @Bonnie_Ruddock,

There are a number of approaches. First, it’s always good form to surround your api calls with a try/catch and handle the exception but some calls return un-expected values as a success but with a failure message so it doesn’t always throw an exception. Second, you can use either Query or findByEmail which both will return an array even if nothing is found (an empty array means no record matched your search) and take it from there with program logic. When adding contacts, if you’re not already doing so, using addWithDupCheck would ensure it’s creation as apposed to using addCon or Add on the data object using the Contact table.

1 Like