【问题标题】:Getresponse lookup contact to see if existsGetresponse 查找联系人以查看是否存在
【发布时间】:2015-09-21 09:44:48
【问题描述】:

我有这段代码可以在 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 参数方面提供任何帮助,我们将不胜感激。

【问题讨论】:

  • 为什么不检查 jsonRPCClient 类中的 get_contacts 方法定义,看看它需要哪些参数?

标签: php json api getresponse


【解决方案1】:

正如我在这里解释的:Getresponse API 2 (Adding Custom fields and contacts using PHP)

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

代替:

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

应该是:

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

祝你好运! :)

【讨论】:

    猜你喜欢
    • 2018-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多