php - Getresponse lookup contact to see if exists -


i have code find contact in getresponse see if exists. first part (getting campaign) works, getting contact fails in exception: request have return error: invalid params:

<?php $jsonfile = 'jsonrpcclient.php';  if (file_exists($jsonfile))      {         require_once $jsonfile;         $api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';         $api_url = 'http://api2.getresponse.com';         $client = new jsonrpcclient($api_url);         $result = null;          // campaign         try             {                 $result = $client->get_campaigns(                     $api_key,                     array (                         'name' => array ( 'equals' => 'my_customer_list' )                     )                 );             }          catch (exception $e)             {                 die($e->getmessage());             }          $campaigns = array_keys($result);         $campaign_id = array_pop($campaigns);          // lookup contact         try             {                 $result = $client->get_contacts(                     $api_key,                     array (                         'campaigns' => $campaign_id,                         'email'     => $track_order_email                     )                 );             }          catch (exception $e)             {                 die($e->getmessage());             }                      } else     {         echo "json include file not found";     }  ?> 

any appreciated in formatting get_contacts parameters.

as explained here: getresponse api 2 (adding custom fields , contacts using php)

both of parameters should formatted differently.

instead of:

array (     'campaigns' => $campaign_id,     'email'     => $track_order_email ) 

it should be:

array (     'campaigns' => array( $campaign_id ),     'email'     => array( 'equals' => $track_order_email ) ) 

good luck! :)


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -