0

Contact Form 7WordPressプラグインからデータを取得し、jsonでデータをに渡そうとしていますGetResponse API

データをプルして送信するphpファイルがあります。CF7の確認メールを受け取っていますが、ニュースレターのGetResponseメールの確認を受け取っていません。理由がわかりません。デバッグを試みました。エラーはありませんでした

add_action('wpcf7_before_send_mail', 'mytheme_save_to_getresponse', 10, 1);
function mytheme_save_to_getresponse($form)
{
include 'ChromePhp.php';

    require_once 'jsonRPCClient.php';
    $api_key = 'some_api_key';
    $api_url = 'http://api2.getresponse.com';
    $client = new jsonRPCClient($api_url);
    $result = NULL;

try {
    $result = $client->get_campaigns(
        $api_key,
        array (
            # find by name literally
            'name' => array ( 'EQUALS' => 'testcase_001' )
        )
    );
}
catch (Exception $e) {
    # check for communication and response errors
    # implement handling if needed
    die($e->getMessage());
}

$campaigns = array_keys($result);
$CAMPAIGN_ID = array_pop($campaigns);

   $subscriberName =  $_POST['name'];
    $subscriberEmail =  $_POST['email'];
    $subscriberPhone =  $_POST['c_phone'];
    $subscriberCellphone =  $_POST['c_cellphone'];
    $subscriberArea =  $_POST['c_area'];
    $subscriberInsuranceType =  $_POST['c_type'];
    $subscriberCarType =  $_POST['c_cartype'];
    $subscriberManifacture =  $_POST['c_manifacture'];
    $subscriberManifacturemodel =  $_POST['c_manifacturemodel'];
    $subscriberManifactureYear =  $_POST['c_manifactureyear'];
    $subscriberDriverAge =  $_POST['c_driversage'];
    $subscriberPrevent =  $_POST['c_prevent'];
    $subscriberClaim =  $_POST['c_claim'];

try {
    $result = $client->add_contact(
        $api_key,
        array (
            'campaign'  => $CAMPAIGN_ID,
            'name'      => $subscriberName,
            'email'     =>  $subscriberEmail,
            'cycle_day' => '0',
            'customs' => array(
                array(
                    'name'       => 'home_phone',
                    'content'    => $subscriberPhone
                ),
                array(
                    'name'       => 'cell_phone',
                    'content'    => $subscriberCellphone
                ),
                array(
                    'name'       => 'living_area',
                    'content'    => $subscriberArea
                ),
                array(
                    'name'       => 'drivers_age',
                    'content'    => $subscriberDriverAge
                ),
                array(
                    'name'       => 'insurance_type',
                    'content'    => $subscriberInsuranceType
                ),
                array(
                    'name'       => 'car_type',
                    'content'    => $subscriberCarType
                ),
                array(
                    'name'       => 'manifacture_type',
                    'content'    => $subscriberManifacture
                ),
                array(
                    'name'       => 'manifacture_model',
                    'content'    => $subscriberManifacturemodel
                ),
                array(
                    'name'       => 'manifacture_year',
                    'content'    => $subscriberManifactureYear
                ),
                array(
                    'name'       => 'license_loss',
                    'content'    => $subscriberPrevent
                ),
                array(
                    'name'       => 'claims_number',
                    'content'    => $subscriberClaim
                )
            )
        )
    );
}
catch (Exception $e) {
    # check for communication and response errors
    # implement handling if needed
    die($e->getMessage());
}
}

前もって感謝します

4

1 に答える 1

0

このコードですべてがOKでした。GetResponseは同じメールで確認リクエストを複数回送信しません。

于 2012-11-28T18:36:54.563 に答える