add subscriber to list without sending confirmation

Usually to add a subscriber to a list you would just embed mailchimp\'s hefty subscribe form. Instead you can use the API and add them and any custom fields as well, without having to have them confirm that they want to be subscribed. The us7 that you see in the $subscribe_url comes from the last part of your api key. See documentation here: http:apidocs.mailchimp.comapi2.0listssubscribe.php

$subscribe_url = \"https:us7.api.mailchimp.com2.0listssubscribe\";

$email_struct = new StdClass();

$email_struct->email = $_REQUEST[\'email\'];

$parameters = array(
    \'apikey\' => \'YOUR-API-KEY-us7\',
    \'id\' => \'LIST-ID\',
    \'email\' => $email_struct,
    \'double_optin\' => false,
    \'send_welcome\' => true
);

$curl = curl_init($subscribe_url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(\'Content-Type: applicationjson\'));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);

echo $response;