doujia1939 2015-09-21 09:44
浏览 73

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

I have this code to find a contact in GetResponse to see if it exists. The first part (getting the campaign) works, but getting the contact fails in an 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;

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

?>

Any help would be appreciated in formatting the get_contacts parameters.

  • 写回答

1条回答 默认 最新

  • drxvjnx58751 2016-04-22 02:36
    关注

    As I explained here: Getresponse API 2 (Adding Custom fields and contacts using PHP)

    both of your parameters should be 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! :)

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题