2017-03-24 10 views
0

MailChimp APIを統合しようとしています。私は2つの異なるライブラリを交換し、同じエラーが発生しました。CodeIgniterでMailChimp APIを使用すると404エラーが発生する

[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機能は私の人生を容易にするために<pre>に包まれprint_rをし、私が持っているヘルパーです。

これは画面をあまりにも長く見て、明らかに見つからないか、MailChimp APIで何か問題が起きていることを望んでいます。

答えて

0

私は問題を解決しましたが、私は間違ったAPIキーとデータセンターを持っていました。彼らのメッセージはもっとはっきりしていたはずです。この間違いをもう一度避けるために、私は設定ファイルに次のように書きました。

$config['api_key'] = '1276381263872163872163872-us11'; 
$data_center = explode("-", $config['api_key']); 
$config['api_endpoint'] = 'https://'.$data_center[1].'.api.mailchimp.com/3.0/'; 
関連する問題