【问题标题】:PHP GetResponse API and CF7 connectionPHP GetResponse API 和 CF7 连接
【发布时间】:2012-11-26 00:03:55
【问题描述】:

我正在尝试从Contact Form 7 WordPress 插件中获取数据并将其与 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());
}
}

提前致谢

【问题讨论】:

    标签: php json wordpress contact-form-7 getresponse


    【解决方案1】:

    此代码一切正常,我 GetResponse 不会在同一封电子邮件中多次发送确认请求..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-03
      相关资源
      最近更新 更多