1
MailChimp APIを使用してキャンペーンを作成したいと考えています。私は以下のコードを使用しています。MailChimp APIによるキャンペーンの作成
$data = ["recipients" => ["list_id" => "a332819b0b"], "type" => "regular", "settings" => ["subject_line" => "Subject", "title" => "Title", "reply_to" => "[email protected]", "from_name" => "Test"]];
$data = json_encode($data);
$curl = curl_init();
curl_setopt_array($curl, [
//Sample url
CURLOPT_URL => "https://us17.api.mailchimp.com/3.0/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => ["apikey:bda3ebf189005dec76dce6b4c77f2527-us17"],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
$response = $err;
}
die($response);
私は以下のように出力しています。
誰も私が問題を解決するのに役立つだろうか?ありがとう。
アカウントのAPIキーはプライベートであるため、変更することをおすすめします。 [この手順に従う](https://kb.mailchimp.com/integrations/api-integrations/about-api-keys#Disable-an-API-Key)この質問のキーを無効にして、新しい他の人があなたのアカウントにアクセスすることはできません。 –