douba3943 2017-08-06 00:16
浏览 69

Wordpress Membermouse获取Mailchimp的数据

I am working on a MemberMouse subscription Wordpress website. I want to get data of the user into the php file via API to a Mailchimp mailing list.

I wrote the following script, that should be called under the condition that once the script is loaded it sends the following php sript:

<?php
require_once 'MCAPI.class.php';
$apikey='Your-API-Key'; // Enter your API key
$api = new MCAPI($apikey);
$retval = $api->lists();
$listid='List-Id'; // Enter list Id here

$uname = $_GET["username"]; // Enter subscriber last name

$email = $_GET["email"]; // Enter subscriber email address


$merge_vars = array('FNAME' => $uname);
if($api->listSubscribe($listid, $email,$merge_vars) === true) {
echo 'success';
}
?>

However, it always gives me an error and can not read the user data. Here is the Membermouse Wordpress Hooks: http://support.membermouse.com/support/solutions/articles/9000020294-membermouse-wordpress-hooks#member-data And here if using PHP interface: https://membermouse.uservoice.com/knowledgebase/articles/319071-using-the-php-interface

The MCAPI.class.php is another php that reads data for Mailchimp. It is simply the MailChimp API PHP Class, which I integrated it into my project.

By the way, manually adding the member via the script above is no problem:

<?php
require_once 'MCAPI.class.php';
$apikey='Your-API-Key'; // Enter your API key
$api = new MCAPI($apikey);
$retval = $api->lists();
$listid='List-Id'; // Enter list Id here
$email='Subscriber-email-address'; // Enter subscriber email address
$name='Subscriber-first-name'; // Enter subscriber first name

// By default this sends a confirmation email - you will not see new members
// until the link contained in it is clicked!

$merge_vars = array('FNAME' => $name);
if($api->listSubscribe($listid, $email,$merge_vars) === true) {
echo 'success';
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥170 如图所示配置eNSP
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效
    • ¥15 悬赏!微信开发者工具报错,求帮改
    • ¥20 wireshark抓不到vlan
    • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
    • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
    • ¥15 stata安慰剂检验作图但是真实值不出现在图上