1

GetResponse で連絡先を見つけて、存在するかどうかを確認するためのこのコードがあります。最初の部分 (キャンペーンの取得) は機能しますが、連絡先の取得は例外で失敗します: 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";
    }

?>

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 に答える