Getresponse查找联系人以查看是否存在



我有这个代码在GetResponse中查找联系人,看看它是否存在。第一部分(获取活动)工作,但在一个异常中获取联系人失败:请求有返回错误:无效参数:

<?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;
        // Get 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";
    }
?>

在格式化get_contacts参数方面,希望能得到任何帮助。

正如我在这里解释的:Getresponse API 2(使用PHP添加自定义字段和联系人)

两个参数的格式应该不同。

代替:

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

应该是:

array (
    'campaigns' => array( $CAMPAIGN_ID ),
    'email'     => array( 'EQUALS' => $track_order_email )
)

祝你好运!:)

最新更新