Amazon SES CURL returning 414 error with large HTML content.

382 views
Skip to first unread message

Matthew Howell

unread,
Mar 21, 2011, 5:41:33 PM3/21/11
to MailChimp API Discuss
I am implementing the Amazon SES wrapper, using a CURL call.

The code works fine (I'm basically just using the sample code) when
the HTML content is small, but with a large chunk of data, I get this
414 error:
Request-URI Too Large
The requested URL's length exceeds the capacity limit for this server.
Apache/2.2.3 (CentOS) Server at us2.sts.mailchimp.com Port 443

How can I create a CURL call to your API endpoint with without a
restriction on the size of the message data?

Thanks!
Matthew

jesse

unread,
Mar 21, 2011, 6:39:25 PM3/21/11
to MailChimp API Discuss
Make a POST call instead of a GET.


jesse

jo

unread,
Mar 29, 2011, 10:09:44 AM3/29/11
to MailChimp API Discuss
Just had the same problem, thanks for the tip, it's working now.

Jo

rbucks

unread,
May 4, 2011, 2:29:07 PM5/4/11
to MailChimp API Discuss
Can you please pretty please send me your curl_setopt code? I've tried
everything and still get the URI capacity error. I know I need to call
POST but it doesn't appear to be working.

Here's a snippet:

$params = array(
'apikey'=>$apikey,
'message'=>$message,
'track_opens'=>true,
'track_clicks'=>false,
'tags'=>$tags
);

$url = "http://us2.sts.mailchimp.com/1.0/
SendEmail";

$ch = curl_init();
$fields_string = '';
foreach($params as $key=>$value)
{ $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

//curl_setopt($ch, CURLOPT_URL,
$url.'?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER,
true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
$fields_string);

$result = curl_exec($ch);


Thanks

Ryan

rbucks

unread,
May 4, 2011, 3:04:34 PM5/4/11
to MailChimp API Discuss
After more hair pulling and nail-biting, here are the settings I used
to get a big html message through Mailchimp STS:

$url = "http://us2.sts.mailchimp.com/1.0/
SendEmail";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_URL,
$url.'?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER,
true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query($params));

Note the // comment is what is suggested by the API docs at
http://apidocs.mailchimp.com/sts/1.0/sendemail.func.php. I think,
given that they put "You are encourage to always make this call with a
POST request." the example given should be a POST request.
Reply all
Reply to author
Forward
0 new messages