Mailchimp API 错误 - 对一直有效的代码的错误请求
Mailchimp API error - Bad Request on code that has always worked
我们最近切换到新服务器,现在我突然收到 mailchimp 的发送活动端点错误。
活动创建时没有任何问题,但发送后出现以下错误。关于可能导致此问题的任何想法?
<HTML><HEAD>
<TITLE>Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Reference #7.640be8ac.1610827794.1757979e
</BODY>
</HTML>
下面是我的PHP代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$this->oauthData['oauth_api_endpoint'].'.api.mailchimp.com/3.0/campaigns/'.$campaignID.'/actions/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/vnd.api+json',
'Content-Type: application/vnd.api+json',
'Authorization: OAuth ' . $this->oauthData['oauth_token']
));
curl_setopt($ch, CURLOPT_USERAGENT, $cuseragnet);
$result = curl_exec($ch);
必须通过一个空数组
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array()));
我们最近切换到新服务器,现在我突然收到 mailchimp 的发送活动端点错误。
活动创建时没有任何问题,但发送后出现以下错误。关于可能导致此问题的任何想法?
<HTML><HEAD>
<TITLE>Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Reference #7.640be8ac.1610827794.1757979e
</BODY>
</HTML>
下面是我的PHP代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$this->oauthData['oauth_api_endpoint'].'.api.mailchimp.com/3.0/campaigns/'.$campaignID.'/actions/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/vnd.api+json',
'Content-Type: application/vnd.api+json',
'Authorization: OAuth ' . $this->oauthData['oauth_token']
));
curl_setopt($ch, CURLOPT_USERAGENT, $cuseragnet);
$result = curl_exec($ch);
必须通过一个空数组
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array()));