This bit of code is causing a critical error when I try to get info from keap

<?php $month = $_POST['month']; foreach ($emails as $email => $e) { //echo $e."
"; $contacts = Infusionsoft DataService::query WithOrderBy(new Infusionsoft Contact(), array('Email' => $e), 'FirstName', false); $get_contact = array_shift($contacts); $member_since_date = $get_contact->_MemberSince; $member_since = date("Y", strtotime($member_since_date)); $TenMinTalkURLs = $get_contact->_TenMinTalkURLs; $TenMinTalkThisMeeting = $get_contact->_TenMinTalkThisMeeting; $GNReferredBy = $get_contact->_GNReferredBy; $RENEWALDATE = $get_contact->_RENEWALDATE; $BookAuthored = $get_contact->_BookAuthored; $FirstMeeting = $get_contact->_FirstMeeting; $SoldBy = $get_contact->_SoldBy; $IveGOT = $get_contact->_IveGOT; $ThatGIVES = $get_contact->_ThatGIVES; $WhichGets = $get_contact->_WhichGets; $Iwanthelpwith = $get_contact->_Iwanthelpwith; $date = $get_contact->_RENEWALDATE; $your_date = date("m-d-y", strtotime($date)); $bday_date = $get_contact->Birthday; if( is_null($bday_date)) { $bday_date_formatted = ''; } else { $bday_date_formatted = date("m-d", strtotime($bday_date)); } //var_dump($get_contact->_Iwanthelpwith); //var_dump($get_contact); $user = get_user_by( 'email', $e); $author = get_userdata($user->ID); $bio = $author->user_description; $bio = nl2br($bio); ?>

What am I doing wrong?

Everything. :joy:

What error is being reported? Can you see it being reported in the log files?

I presume that you have done the usual API connection prior to the main code being run?

From what I can tell your code is looping through an Array of Email Addresses which have been stored in the the “$emails” variable. It then queries Infusionsoft via the Email Address to get the Contact Record details. If the person has a Birthday it gets the User details from Wordpress.

I presume that this is just part of the code, you have other parts that continue you to do other things. You are missing the closing “if” and “for loop” brackets if that is not the case.

You can config Wordpress to output the Errors if you can via the “wp-config.php” file.
More information can be found here: Debugging in WordPress – WordPress.org Forums

Here is your code formatted with the “[ code ]” tag (without spaces) around it.

<?php 
$month = $_POST['month']; 

foreach ($emails as $email => $e) 
{ 
    //echo $e.""; 
    $contacts = Infusionsoft DataService::queryWithOrderBy(new Infusionsoft Contact(), array('Email' => $e), 'FirstName', false); 
    $get_contact = array_shift($contacts); 
    $member_since_date = $get_contact->_MemberSince; 
    $member_since = date("Y", strtotime($member_since_date)); 
    $TenMinTalkURLs = $get_contact->_TenMinTalkURLs; 
    $TenMinTalkThisMeeting = $get_contact->_TenMinTalkThisMeeting; 
    $GNReferredBy = $get_contact->_GNReferredBy; 
    $RENEWALDATE = $get_contact->_RENEWALDATE; 
    $BookAuthored = $get_contact->_BookAuthored; 
    $FirstMeeting = $get_contact->_FirstMeeting; 
    $SoldBy = $get_contact->_SoldBy; 
    $IveGOT = $get_contact->_IveGOT; 
    $ThatGIVES = $get_contact->_ThatGIVES; 
    $WhichGets = $get_contact->_WhichGets; 
    $Iwanthelpwith = $get_contact->_Iwanthelpwith; 
    $date = $get_contact->_RENEWALDATE; 
    $your_date = date("m-d-y", strtotime($date)); 
    $bday_date = $get_contact->Birthday; 

    if( is_null($bday_date)) 
    { 
        $bday_date_formatted = ''; 
    } 
    else 
    { 
         $bday_date_formatted = date("m-d", strtotime($bday_date)); } 
         //var_dump($get_contact->_Iwanthelpwith); 
         //var_dump($get_contact); 
         $user = get_user_by( 'email', $e); 
         $author = get_userdata($user->ID); 
         $bio = $author->user_description; 
         $bio = nl2br($bio); 
?>

Thank you for formatting the code. I inherited this and it stopped working recently. I get an error at xmlcr.inc line 2661 for the data count.

When I take out that section of code that’s trying to connect to infusionsoft, it runs. I did not set up the connection calls, so I’m not sure if they are what’s breaking. He is using a folder called infusionsoft, but it’s not a regularly installed plugin. Any idea if a recent update changed how the code should connect?

It sounds like you have inherited an older or customised version of the SDK here.

Problem is that XML-RPC Library has changed over the years, so replacing the file with the latest version will break things. You would need to make code changes to support it.

Do you know if PHP has recently been updated for the website?

Older versions of the library will either report warnings or parts of it may just fail.

Is other Infusionsoft API functionality still working on the website?

We really only use forms, so not sure.

Is there an updated sdk pre-built? Or do I have to build it? I know just enough of php to be dangerous.

But from what you describe, I just needed that confirmation because that was my initial assumption as well. I was hoping maybe the syntax had changed in the code I sent, but I think you’re right. I need a new sdk.

@Jen_Anderson ,

I get this in sdk’s using the older xmlrpc module and it’s due to a parameter to a function not being typecast to array. I trace to the function in the xmlrpc file and put (array) before the parameter and that seems to fix it. I think it’s only a notification though? If so then you could also suppress notifications about upcoming deprecations.