public post ( string $method, array $args = [], integer $timeout = 10 ) : array | false | ||
$method | string | URL of the API request method |
$args | array | Assoc array of arguments (usually your data) |
$timeout | integer | Timeout limit for request in seconds |
return | array | false | Assoc array of API response, decoded from JSON |
public function post($method, $args = array(), $timeout = 10)
{
return $this->makeRequest('post', $method, $args, $timeout);
}
<?php echo "hello"; include 'MailChimp.php'; use DrewM\MailChimp\MailChimp; $MailChimp = new MailChimp('8daa36240ea1db9c35580a95c534c55b-us12'); $list_id = '99a9b4b2d4'; $result = $MailChimp->post("lists/{$list_id}/members", ['email_address' => '*****@*****.**', 'status' => 'subscribed']); print_r($result); // $fname = mysql_escape_string($_POST['first_name']); // $lname = mysql_escape_string($_POST['last_name']); // $email = mysql_escape_string($_POST['email']); // $title = mysql_escape_string($_POST['title']); // // if(strlen($title) > 0){ // header('HTTP/1.1 401 Unauthorized'); // exit; // }else{ // $MailChimp = new \Drewm\MailChimp('867cf1372a079e8f588fc974482af793-us10'); // $result = $MailChimp->call('lists/subscribe', array( // 'id' => 'f0f1e0de59', // 'email' => array('email'=>$email), // 'merge_vars' => array('FNAME'=>$fname, 'LNAME'=>$lname), // 'double_optin' => false, // 'update_existing' => true, // 'replace_interests' => false, // 'send_welcome' => false, // )); // // if($result){ // header('HTTP/1.1 200 Success');