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! :)

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿