【发布时间】:2017-08-16 22:52:55
【问题描述】:
我正在尝试集成 MailChimp API。我切换了两个不同的库并得到相同的错误。
[type] => http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
[title] => Resource Not Found
[status] => 404
[detail] => The requested resource could not be found.
[instance] =>
很遗憾,这个错误没有为我提供任何有用的信息。我使用的库是this one。
这是我在控制器中使用的代码:
function __construct(){
parent::__construct();
$this->load->library('mailchimp');
$this->common = array(
'list_id' => '12345678',
);
}
public function signup() {
$form = $this->input->post();
if ( !empty($form['website']) ) {
// If Honey Pot is filled out
redirect('https://www.google.com');
} else {
$result = $this->mailchimp->call('POST',
'lists/'.$this->common['list_id'].'/members',
array(
'email_address' => $form['email'],
'merge_fields' => array(
"FNAME" => $form['first_name'],
"LNAME" => $form['last_name']
),
'status' => 'subscribed',
)
);
debug($result);
return true;
// Check Result
if ( $result['status'] !== 'subscribed' && $result['status'] !== 'pending' ) {
return false;
} else {
return true;
}
}
}
debug 函数是我的一个助手,它可以将 print_r 包裹在 <pre> 中,让我的生活更轻松。
我希望这只是盯着屏幕太久而错过了明显的东西或者 MailChimp API 有问题的情况。
【问题讨论】:
标签: php codeigniter mailchimp