View file File name : send.php Content :<?php /*api key: 04f53e3241eea119be17a71c6dde5254-us13 */ /*list id: bf136f8469 */ /*my, for test*/ /*api key: 9322cfc9b49ff81c6d5d21f4fefbffa3-us16 */ /*list id: 1d709cf1a6 */ if((isset($_POST['email']) && $_POST['email']!="")) { $email = $_POST['email']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $phone = $_POST['phone']; $postal_code = $_POST['postal_code']; $gender = $_POST['gender']; $vehicle = $_POST['vehicle']; $long = $_POST['how_long']; $msg; // MailChimp API credentials $apiKey = '9322cfc9b49ff81c6d5d21f4fefbffa3-us16'; $listID = '1d709cf1a6'; // MailChimp API URL $memberID = md5(strtolower($email)); $dataCenter = substr($apiKey,strpos($apiKey,'-')+1); $url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listID . '/members/' . $memberID; // member information $json = json_encode([ 'email_address' => $email, 'status' => 'subscribed' ]); // send a HTTP POST request with curl $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } ?>