1

我有这段代码可以在 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 参数时,我们将不胜感激。

4

1 回答 1

0

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

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

代替:

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

它应该是:

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

祝你好运!:)

于 2016-04-22T02:36:08.427 回答