Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mailchimp与PHP集成,但它不显示已经存在的消息,而是覆盖_Php_Html_Mailchimp - Fatal编程技术网

Mailchimp与PHP集成,但它不显示已经存在的消息,而是覆盖

Mailchimp与PHP集成,但它不显示已经存在的消息,而是覆盖,php,html,mailchimp,Php,Html,Mailchimp,我已经将mailchimp与我的php网站集成在一起进行订阅,但问题是当同一个用户重新输入他的详细信息时,它仍然会说“谢谢你被添加到邮件列表”,而不是说“你已经订阅了” 尝试了很多,但是我的按钮或者代码停止工作了 HTML代码: <form id="signup" class="formee" action="php/subscribe.php" method="post"> <div class="form-group has-feedback"&

我已经将mailchimp与我的php网站集成在一起进行订阅,但问题是当同一个用户重新输入他的详细信息时,它仍然会说“谢谢你被添加到邮件列表”,而不是说“你已经订阅了”

尝试了很多,但是我的按钮或者代码停止工作了

HTML代码:

<form  id="signup" class="formee" action="php/subscribe.php" method="post">

            <div class="form-group has-feedback">
                        <label>First Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="fname" name="fname" >
                        <label>Last Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="lname" name="lname">
                        <label>Email Address</label>
                        <div class="clearfix"></div>
                        <input type="text" id="email" name="email">
                <div class="newsletter-submit">
                        <button class="btn btn_newslatter right inputnew"  type="submit" title="Submit" value="Send" >Submit</button>
                </div>
                <div id="response"></div>

            </div>

            </form>
 <script type="text/javascript">
$(document).ready(function(a){


        // jQuery Validation
        $("#signup").validate({
            // if valid, post data via AJAX
            submitHandler: function(form) {
                $.post("php/subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
                    $('#response').html(data);
                });
            },
            // all fields are required
            rules: {
                fname: {
                    required: false
                },
                lname: {
                    required: false
                },
                email: {
                    required: true,
                    email: true
                }
            }
        });
<?php
require_once 'MCAPI.class.php';
$api = new MCAPI('xxxxxxxxxxxx');
$merge_vars = array('FNAME'=>$_POST["fname"], 'LNAME'=>$_POST["lname"]);

// Submit subscriber data to MailChimp
// For parameters doc, refer to: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
$retval = $api->listSubscribe( 'xxxxxxx', $_POST["email"], $merge_vars, 'html', false, true );

if ($api->errorCode){
    echo "<h4>Please try again.</h4>";
} else {
    echo "<h4>Thank you, you have been added to our mailing list.</h4>";
}


        // store the status message based on response code
        if ($httpCode == 200) {
            $_SESSION['msg'] = '<p style="color: #34A853">You have successfully subscribed to CodexWorld.</p>';
        } else {
            switch ($httpCode) {
                case 214:
                    $msg = 'You are already subscribed.';
                    break;
                default:
                    $msg = 'Some problem occurred, please try again.';
                    break;
            }
            $_SESSION['msg'] = '<p style="color: #EA4335">'.$msg.'</p>';
        }

?>
    <?php 
class MCAPI {
    var $version = "1.3";
    var $errorMessage;
    var $errorCode;

    /**
     * Cache the information on the API location on the server
     */
    var $apiUrl;

    /**
     * Default to a 300 second timeout on server calls
     */
    var $timeout = 300; 

    /**
     * Default to a 8K chunk size
     */
    var $chunkSize = 8192;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $api_key;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $secure = false;

    /**
     * Connect to the MailChimp API for a given list.
     * 
     * @param string $apikey Your MailChimp apikey
     * @param string $secure Whether or not this should use a secure connection
     */
    function MCAPI($apikey, $secure=false) {
        $this->secure = $secure;
        $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
        $this->api_key = $apikey;
    }
    function setTimeout($seconds){
        if (is_int($seconds)){
            $this->timeout = $seconds;
            return true;
        }
    }
    function getTimeout(){
        return $this->timeout;
    }
    function useSecure($val){
        if ($val===true){
            $this->secure = true;
        } else {
            $this->secure = false;
        }
    }

    /**
     * Actually connect to the server and call the requested methods, parsing the result
     * You should never have to call this function manually
     */
    function __call($method, $params) {
        $dc = "us1";
        if (strstr($this->api_key,"-")){
            list($key, $dc) = explode("-",$this->api_key,2);
            if (!$dc) $dc = "us1";
        }
        $host = $dc.".".$this->apiUrl["host"];

        $this->errorMessage = "";
        $this->errorCode = "";
        $sep_changed = false;
        //sigh, apparently some distribs change this to &amp; by default
        if (ini_get("arg_separator.output")!="&"){
            $sep_changed = true;
            $orig_sep = ini_get("arg_separator.output");
            ini_set("arg_separator.output", "&");
        }
        //mutate params
        $mutate = array();
        $mutate["apikey"] = $this->api_key;
        foreach($params as $k=>$v){
            $mutate[$this->function_map[$method][$k]] = $v;
        }
        $post_vars = http_build_query($mutate);
        if ($sep_changed){
            ini_set("arg_separator.output", $orig_sep);
        }

        $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
        $payload .= "Host: " . $host . "\r\n";
        $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
        $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
        $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
        $payload .= "Connection: close \r\n\r\n";
        $payload .= $post_vars;

        ob_start();
        if ($this->secure){
            $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
        } else {
            $sock = fsockopen($host, 80, $errno, $errstr, 30);
        }
        if(!$sock) {
            $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
            $this->errorCode = "-99";
            ob_end_clean();
            return false;
        }

        $response = "";
        fwrite($sock, $payload);
        stream_set_timeout($sock, $this->timeout);
        $info = stream_get_meta_data($sock);
        while ((!feof($sock)) && (!$info["timed_out"])) {
            $response .= fread($sock, $this->chunkSize);
            $info = stream_get_meta_data($sock);
        }
        fclose($sock);
        ob_end_clean();
        if ($info["timed_out"]) {
            $this->errorMessage = "Could not read response (timed out)";
            $this->errorCode = -98;
            return false;
        }

        list($headers, $response) = explode("\r\n\r\n", $response, 2);
        $headers = explode("\r\n", $headers);
        $errored = false;
        foreach($headers as $h){
            if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
                $errored = true;
                $error_code = trim(substr($h,27));
                break;
            }
        }

        if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);

        $serial = unserialize($response);
        if($response && $serial === false) {
            $response = array("error" => "Bad Response.  Got This: " . $response, "code" => "-99");
        } else {
            $response = $serial;
        }
        if($errored && is_array($response) && isset($response["error"])) {
            $this->errorMessage = $response["error"];
            $this->errorCode = $response["code"];
            return false;
        } elseif($errored){
            $this->errorMessage = "No error message was found";
            $this->errorCode = $error_code;
            return false;
        }

        return $response;
    }

    protected $function_map = array('campaignUnschedule'=>array("cid"),
'campaignSchedule'=>array("cid","schedule_time","schedule_time_b"),
'campaignScheduleBatch'=>array("cid","schedule_time","num_batches","stagger_mins"),
'campaignResume'=>array("cid"),
'campaignPause'=>array("cid"),
'campaignSendNow'=>array("cid"),
'campaignSendTest'=>array("cid","test_emails","send_type"),
'campaignSegmentTest'=>array("list_id","options"),
'campaignCreate'=>array("type","options","content","segment_opts","type_opts"),
'campaignUpdate'=>array("cid","name","value"),
'campaignReplicate'=>array("cid"),
'campaignDelete'=>array("cid"),
'campaigns'=>array("filters","start","limit","sort_field","sort_dir"),
'campaignStats'=>array("cid"),
'campaignClickStats'=>array("cid"),
'campaignEmailDomainPerformance'=>array("cid"),
'campaignMembers'=>array("cid","status","start","limit"),
'campaignHardBounces'=>array("cid","start","limit"),
'campaignSoftBounces'=>array("cid","start","limit"),
'campaignUnsubscribes'=>array("cid","start","limit"),
'campaignAbuseReports'=>array("cid","since","start","limit"),
'campaignAdvice'=>array("cid"),
'campaignAnalytics'=>array("cid"),
'campaignGeoOpens'=>array("cid"),
'campaignGeoOpensForCountry'=>array("cid","code"),
'campaignEepUrlStats'=>array("cid"),
'campaignBounceMessage'=>array("cid","email"),
'campaignBounceMessages'=>array("cid","start","limit","since"),
'campaignEcommOrders'=>array("cid","start","limit","since"),
'campaignShareReport'=>array("cid","opts"),
'campaignContent'=>array("cid","for_archive"),
'campaignTemplateContent'=>array("cid"),
'campaignOpenedAIM'=>array("cid","start","limit"),
'campaignNotOpenedAIM'=>array("cid","start","limit"),
'campaignClickDetailAIM'=>array("cid","url","start","limit"),
'campaignEmailStatsAIM'=>array("cid","email_address"),
'campaignEmailStatsAIMAll'=>array("cid","start","limit"),
'campaignEcommOrderAdd'=>array("order"),
'lists'=>array("filters","start","limit","sort_field","sort_dir"),
'listMergeVars'=>array("id"),
'listMergeVarAdd'=>array("id","tag","name","options"),
'listMergeVarUpdate'=>array("id","tag","options"),
'listMergeVarDel'=>array("id","tag"),
'listMergeVarReset'=>array("id","tag"),
'listInterestGroupings'=>array("id"),
'listInterestGroupAdd'=>array("id","group_name","grouping_id"),
'listInterestGroupDel'=>array("id","group_name","grouping_id"),
'listInterestGroupUpdate'=>array("id","old_name","new_name","grouping_id"),
'listInterestGroupingAdd'=>array("id","name","type","groups"),
'listInterestGroupingUpdate'=>array("grouping_id","name","value"),
'listInterestGroupingDel'=>array("grouping_id"),
'listWebhooks'=>array("id"),
'listWebhookAdd'=>array("id","url","actions","sources"),
'listWebhookDel'=>array("id","url"),
'listStaticSegments'=>array("id"),
'listStaticSegmentAdd'=>array("id","name"),
'listStaticSegmentReset'=>array("id","seg_id"),
'listStaticSegmentDel'=>array("id","seg_id"),
'listStaticSegmentMembersAdd'=>array("id","seg_id","batch"),
'listStaticSegmentMembersDel'=>array("id","seg_id","batch"),
'listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome"),
'listUnsubscribe'=>array("id","email_address","delete_member","send_goodbye","send_notify"),
'listUpdateMember'=>array("id","email_address","merge_vars","email_type","replace_interests"),
'listBatchSubscribe'=>array("id","batch","double_optin","update_existing","replace_interests"),
'listBatchUnsubscribe'=>array("id","emails","delete_member","send_goodbye","send_notify"),
'listMembers'=>array("id","status","since","start","limit","sort_dir"),
'listMemberInfo'=>array("id","email_address"),
'listMemberActivity'=>array("id","email_address"),
'listAbuseReports'=>array("id","start","limit","since"),
'listGrowthHistory'=>array("id"),
'listActivity'=>array("id"),
'listLocations'=>array("id"),
'listClients'=>array("id"),
'templates'=>array("types","category","inactives"),
'templateInfo'=>array("tid","type"),
'templateAdd'=>array("name","html"),
'templateUpdate'=>array("id","values"),
'templateDel'=>array("id"),
'templateUndel'=>array("id"),
'getAccountDetails'=>array("exclude"),
'getVerifiedDomains'=>array(),
'generateText'=>array("type","content"),
'inlineCss'=>array("html","strip_css"),
'folders'=>array("type"),
'folderAdd'=>array("name","type"),
'folderUpdate'=>array("fid","name","type"),
'folderDel'=>array("fid","type"),
'ecommOrders'=>array("start","limit","since"),
'ecommOrderAdd'=>array("order"),
'ecommOrderDel'=>array("store_id","order_id"),
'listsForEmail'=>array("email_address"),
'campaignsForEmail'=>array("email_address","options"),
'chimpChatter'=>array(),
'searchMembers'=>array("query","id","offset"),
'searchCampaigns'=>array("query","offset","snip_start","snip_end"),
'apikeys'=>array("username","password","expired"),
'apikeyAdd'=>array("username","password"),
'apikeyExpire'=>array("username","password"),
'ping'=>array(),
'deviceRegister'=>array("mobile_key","details"),
'deviceUnregister'=>array("mobile_key","device_id"),
'gmonkeyAdd'=>array("id","email_address"),
'gmonkeyDel'=>array("id","email_address"),
'gmonkeyMembers'=>array(),
'gmonkeyActivity'=>array());

}

?>

名字
姓
电子邮件地址
提交
JS:

<form  id="signup" class="formee" action="php/subscribe.php" method="post">

            <div class="form-group has-feedback">
                        <label>First Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="fname" name="fname" >
                        <label>Last Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="lname" name="lname">
                        <label>Email Address</label>
                        <div class="clearfix"></div>
                        <input type="text" id="email" name="email">
                <div class="newsletter-submit">
                        <button class="btn btn_newslatter right inputnew"  type="submit" title="Submit" value="Send" >Submit</button>
                </div>
                <div id="response"></div>

            </div>

            </form>
 <script type="text/javascript">
$(document).ready(function(a){


        // jQuery Validation
        $("#signup").validate({
            // if valid, post data via AJAX
            submitHandler: function(form) {
                $.post("php/subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
                    $('#response').html(data);
                });
            },
            // all fields are required
            rules: {
                fname: {
                    required: false
                },
                lname: {
                    required: false
                },
                email: {
                    required: true,
                    email: true
                }
            }
        });
<?php
require_once 'MCAPI.class.php';
$api = new MCAPI('xxxxxxxxxxxx');
$merge_vars = array('FNAME'=>$_POST["fname"], 'LNAME'=>$_POST["lname"]);

// Submit subscriber data to MailChimp
// For parameters doc, refer to: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
$retval = $api->listSubscribe( 'xxxxxxx', $_POST["email"], $merge_vars, 'html', false, true );

if ($api->errorCode){
    echo "<h4>Please try again.</h4>";
} else {
    echo "<h4>Thank you, you have been added to our mailing list.</h4>";
}


        // store the status message based on response code
        if ($httpCode == 200) {
            $_SESSION['msg'] = '<p style="color: #34A853">You have successfully subscribed to CodexWorld.</p>';
        } else {
            switch ($httpCode) {
                case 214:
                    $msg = 'You are already subscribed.';
                    break;
                default:
                    $msg = 'Some problem occurred, please try again.';
                    break;
            }
            $_SESSION['msg'] = '<p style="color: #EA4335">'.$msg.'</p>';
        }

?>
    <?php 
class MCAPI {
    var $version = "1.3";
    var $errorMessage;
    var $errorCode;

    /**
     * Cache the information on the API location on the server
     */
    var $apiUrl;

    /**
     * Default to a 300 second timeout on server calls
     */
    var $timeout = 300; 

    /**
     * Default to a 8K chunk size
     */
    var $chunkSize = 8192;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $api_key;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $secure = false;

    /**
     * Connect to the MailChimp API for a given list.
     * 
     * @param string $apikey Your MailChimp apikey
     * @param string $secure Whether or not this should use a secure connection
     */
    function MCAPI($apikey, $secure=false) {
        $this->secure = $secure;
        $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
        $this->api_key = $apikey;
    }
    function setTimeout($seconds){
        if (is_int($seconds)){
            $this->timeout = $seconds;
            return true;
        }
    }
    function getTimeout(){
        return $this->timeout;
    }
    function useSecure($val){
        if ($val===true){
            $this->secure = true;
        } else {
            $this->secure = false;
        }
    }

    /**
     * Actually connect to the server and call the requested methods, parsing the result
     * You should never have to call this function manually
     */
    function __call($method, $params) {
        $dc = "us1";
        if (strstr($this->api_key,"-")){
            list($key, $dc) = explode("-",$this->api_key,2);
            if (!$dc) $dc = "us1";
        }
        $host = $dc.".".$this->apiUrl["host"];

        $this->errorMessage = "";
        $this->errorCode = "";
        $sep_changed = false;
        //sigh, apparently some distribs change this to &amp; by default
        if (ini_get("arg_separator.output")!="&"){
            $sep_changed = true;
            $orig_sep = ini_get("arg_separator.output");
            ini_set("arg_separator.output", "&");
        }
        //mutate params
        $mutate = array();
        $mutate["apikey"] = $this->api_key;
        foreach($params as $k=>$v){
            $mutate[$this->function_map[$method][$k]] = $v;
        }
        $post_vars = http_build_query($mutate);
        if ($sep_changed){
            ini_set("arg_separator.output", $orig_sep);
        }

        $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
        $payload .= "Host: " . $host . "\r\n";
        $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
        $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
        $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
        $payload .= "Connection: close \r\n\r\n";
        $payload .= $post_vars;

        ob_start();
        if ($this->secure){
            $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
        } else {
            $sock = fsockopen($host, 80, $errno, $errstr, 30);
        }
        if(!$sock) {
            $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
            $this->errorCode = "-99";
            ob_end_clean();
            return false;
        }

        $response = "";
        fwrite($sock, $payload);
        stream_set_timeout($sock, $this->timeout);
        $info = stream_get_meta_data($sock);
        while ((!feof($sock)) && (!$info["timed_out"])) {
            $response .= fread($sock, $this->chunkSize);
            $info = stream_get_meta_data($sock);
        }
        fclose($sock);
        ob_end_clean();
        if ($info["timed_out"]) {
            $this->errorMessage = "Could not read response (timed out)";
            $this->errorCode = -98;
            return false;
        }

        list($headers, $response) = explode("\r\n\r\n", $response, 2);
        $headers = explode("\r\n", $headers);
        $errored = false;
        foreach($headers as $h){
            if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
                $errored = true;
                $error_code = trim(substr($h,27));
                break;
            }
        }

        if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);

        $serial = unserialize($response);
        if($response && $serial === false) {
            $response = array("error" => "Bad Response.  Got This: " . $response, "code" => "-99");
        } else {
            $response = $serial;
        }
        if($errored && is_array($response) && isset($response["error"])) {
            $this->errorMessage = $response["error"];
            $this->errorCode = $response["code"];
            return false;
        } elseif($errored){
            $this->errorMessage = "No error message was found";
            $this->errorCode = $error_code;
            return false;
        }

        return $response;
    }

    protected $function_map = array('campaignUnschedule'=>array("cid"),
'campaignSchedule'=>array("cid","schedule_time","schedule_time_b"),
'campaignScheduleBatch'=>array("cid","schedule_time","num_batches","stagger_mins"),
'campaignResume'=>array("cid"),
'campaignPause'=>array("cid"),
'campaignSendNow'=>array("cid"),
'campaignSendTest'=>array("cid","test_emails","send_type"),
'campaignSegmentTest'=>array("list_id","options"),
'campaignCreate'=>array("type","options","content","segment_opts","type_opts"),
'campaignUpdate'=>array("cid","name","value"),
'campaignReplicate'=>array("cid"),
'campaignDelete'=>array("cid"),
'campaigns'=>array("filters","start","limit","sort_field","sort_dir"),
'campaignStats'=>array("cid"),
'campaignClickStats'=>array("cid"),
'campaignEmailDomainPerformance'=>array("cid"),
'campaignMembers'=>array("cid","status","start","limit"),
'campaignHardBounces'=>array("cid","start","limit"),
'campaignSoftBounces'=>array("cid","start","limit"),
'campaignUnsubscribes'=>array("cid","start","limit"),
'campaignAbuseReports'=>array("cid","since","start","limit"),
'campaignAdvice'=>array("cid"),
'campaignAnalytics'=>array("cid"),
'campaignGeoOpens'=>array("cid"),
'campaignGeoOpensForCountry'=>array("cid","code"),
'campaignEepUrlStats'=>array("cid"),
'campaignBounceMessage'=>array("cid","email"),
'campaignBounceMessages'=>array("cid","start","limit","since"),
'campaignEcommOrders'=>array("cid","start","limit","since"),
'campaignShareReport'=>array("cid","opts"),
'campaignContent'=>array("cid","for_archive"),
'campaignTemplateContent'=>array("cid"),
'campaignOpenedAIM'=>array("cid","start","limit"),
'campaignNotOpenedAIM'=>array("cid","start","limit"),
'campaignClickDetailAIM'=>array("cid","url","start","limit"),
'campaignEmailStatsAIM'=>array("cid","email_address"),
'campaignEmailStatsAIMAll'=>array("cid","start","limit"),
'campaignEcommOrderAdd'=>array("order"),
'lists'=>array("filters","start","limit","sort_field","sort_dir"),
'listMergeVars'=>array("id"),
'listMergeVarAdd'=>array("id","tag","name","options"),
'listMergeVarUpdate'=>array("id","tag","options"),
'listMergeVarDel'=>array("id","tag"),
'listMergeVarReset'=>array("id","tag"),
'listInterestGroupings'=>array("id"),
'listInterestGroupAdd'=>array("id","group_name","grouping_id"),
'listInterestGroupDel'=>array("id","group_name","grouping_id"),
'listInterestGroupUpdate'=>array("id","old_name","new_name","grouping_id"),
'listInterestGroupingAdd'=>array("id","name","type","groups"),
'listInterestGroupingUpdate'=>array("grouping_id","name","value"),
'listInterestGroupingDel'=>array("grouping_id"),
'listWebhooks'=>array("id"),
'listWebhookAdd'=>array("id","url","actions","sources"),
'listWebhookDel'=>array("id","url"),
'listStaticSegments'=>array("id"),
'listStaticSegmentAdd'=>array("id","name"),
'listStaticSegmentReset'=>array("id","seg_id"),
'listStaticSegmentDel'=>array("id","seg_id"),
'listStaticSegmentMembersAdd'=>array("id","seg_id","batch"),
'listStaticSegmentMembersDel'=>array("id","seg_id","batch"),
'listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome"),
'listUnsubscribe'=>array("id","email_address","delete_member","send_goodbye","send_notify"),
'listUpdateMember'=>array("id","email_address","merge_vars","email_type","replace_interests"),
'listBatchSubscribe'=>array("id","batch","double_optin","update_existing","replace_interests"),
'listBatchUnsubscribe'=>array("id","emails","delete_member","send_goodbye","send_notify"),
'listMembers'=>array("id","status","since","start","limit","sort_dir"),
'listMemberInfo'=>array("id","email_address"),
'listMemberActivity'=>array("id","email_address"),
'listAbuseReports'=>array("id","start","limit","since"),
'listGrowthHistory'=>array("id"),
'listActivity'=>array("id"),
'listLocations'=>array("id"),
'listClients'=>array("id"),
'templates'=>array("types","category","inactives"),
'templateInfo'=>array("tid","type"),
'templateAdd'=>array("name","html"),
'templateUpdate'=>array("id","values"),
'templateDel'=>array("id"),
'templateUndel'=>array("id"),
'getAccountDetails'=>array("exclude"),
'getVerifiedDomains'=>array(),
'generateText'=>array("type","content"),
'inlineCss'=>array("html","strip_css"),
'folders'=>array("type"),
'folderAdd'=>array("name","type"),
'folderUpdate'=>array("fid","name","type"),
'folderDel'=>array("fid","type"),
'ecommOrders'=>array("start","limit","since"),
'ecommOrderAdd'=>array("order"),
'ecommOrderDel'=>array("store_id","order_id"),
'listsForEmail'=>array("email_address"),
'campaignsForEmail'=>array("email_address","options"),
'chimpChatter'=>array(),
'searchMembers'=>array("query","id","offset"),
'searchCampaigns'=>array("query","offset","snip_start","snip_end"),
'apikeys'=>array("username","password","expired"),
'apikeyAdd'=>array("username","password"),
'apikeyExpire'=>array("username","password"),
'ping'=>array(),
'deviceRegister'=>array("mobile_key","details"),
'deviceUnregister'=>array("mobile_key","device_id"),
'gmonkeyAdd'=>array("id","email_address"),
'gmonkeyDel'=>array("id","email_address"),
'gmonkeyMembers'=>array(),
'gmonkeyActivity'=>array());

}

?>

$(文档).ready(函数(a){
//jQuery验证
$(“#注册”).validate({
//如果有效,则通过AJAX发布数据
submitHandler:函数(表单){
$.post(“php/subscribe.php”,{fname:$(“#fname”).val(),lname:$(“#lname”).val(),email:$(“#email”).val(),函数(数据){
$('#response').html(数据);
});
},
//所有字段都是必填字段
规则:{
fname:{
必填项:false
},
名称:{
必填项:false
},
电邮:{
要求:正确,
电子邮件:真的
}
}
});
PHP(subscribe.PHP):

<form  id="signup" class="formee" action="php/subscribe.php" method="post">

            <div class="form-group has-feedback">
                        <label>First Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="fname" name="fname" >
                        <label>Last Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="lname" name="lname">
                        <label>Email Address</label>
                        <div class="clearfix"></div>
                        <input type="text" id="email" name="email">
                <div class="newsletter-submit">
                        <button class="btn btn_newslatter right inputnew"  type="submit" title="Submit" value="Send" >Submit</button>
                </div>
                <div id="response"></div>

            </div>

            </form>
 <script type="text/javascript">
$(document).ready(function(a){


        // jQuery Validation
        $("#signup").validate({
            // if valid, post data via AJAX
            submitHandler: function(form) {
                $.post("php/subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
                    $('#response').html(data);
                });
            },
            // all fields are required
            rules: {
                fname: {
                    required: false
                },
                lname: {
                    required: false
                },
                email: {
                    required: true,
                    email: true
                }
            }
        });
<?php
require_once 'MCAPI.class.php';
$api = new MCAPI('xxxxxxxxxxxx');
$merge_vars = array('FNAME'=>$_POST["fname"], 'LNAME'=>$_POST["lname"]);

// Submit subscriber data to MailChimp
// For parameters doc, refer to: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
$retval = $api->listSubscribe( 'xxxxxxx', $_POST["email"], $merge_vars, 'html', false, true );

if ($api->errorCode){
    echo "<h4>Please try again.</h4>";
} else {
    echo "<h4>Thank you, you have been added to our mailing list.</h4>";
}


        // store the status message based on response code
        if ($httpCode == 200) {
            $_SESSION['msg'] = '<p style="color: #34A853">You have successfully subscribed to CodexWorld.</p>';
        } else {
            switch ($httpCode) {
                case 214:
                    $msg = 'You are already subscribed.';
                    break;
                default:
                    $msg = 'Some problem occurred, please try again.';
                    break;
            }
            $_SESSION['msg'] = '<p style="color: #EA4335">'.$msg.'</p>';
        }

?>
    <?php 
class MCAPI {
    var $version = "1.3";
    var $errorMessage;
    var $errorCode;

    /**
     * Cache the information on the API location on the server
     */
    var $apiUrl;

    /**
     * Default to a 300 second timeout on server calls
     */
    var $timeout = 300; 

    /**
     * Default to a 8K chunk size
     */
    var $chunkSize = 8192;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $api_key;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $secure = false;

    /**
     * Connect to the MailChimp API for a given list.
     * 
     * @param string $apikey Your MailChimp apikey
     * @param string $secure Whether or not this should use a secure connection
     */
    function MCAPI($apikey, $secure=false) {
        $this->secure = $secure;
        $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
        $this->api_key = $apikey;
    }
    function setTimeout($seconds){
        if (is_int($seconds)){
            $this->timeout = $seconds;
            return true;
        }
    }
    function getTimeout(){
        return $this->timeout;
    }
    function useSecure($val){
        if ($val===true){
            $this->secure = true;
        } else {
            $this->secure = false;
        }
    }

    /**
     * Actually connect to the server and call the requested methods, parsing the result
     * You should never have to call this function manually
     */
    function __call($method, $params) {
        $dc = "us1";
        if (strstr($this->api_key,"-")){
            list($key, $dc) = explode("-",$this->api_key,2);
            if (!$dc) $dc = "us1";
        }
        $host = $dc.".".$this->apiUrl["host"];

        $this->errorMessage = "";
        $this->errorCode = "";
        $sep_changed = false;
        //sigh, apparently some distribs change this to &amp; by default
        if (ini_get("arg_separator.output")!="&"){
            $sep_changed = true;
            $orig_sep = ini_get("arg_separator.output");
            ini_set("arg_separator.output", "&");
        }
        //mutate params
        $mutate = array();
        $mutate["apikey"] = $this->api_key;
        foreach($params as $k=>$v){
            $mutate[$this->function_map[$method][$k]] = $v;
        }
        $post_vars = http_build_query($mutate);
        if ($sep_changed){
            ini_set("arg_separator.output", $orig_sep);
        }

        $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
        $payload .= "Host: " . $host . "\r\n";
        $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
        $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
        $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
        $payload .= "Connection: close \r\n\r\n";
        $payload .= $post_vars;

        ob_start();
        if ($this->secure){
            $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
        } else {
            $sock = fsockopen($host, 80, $errno, $errstr, 30);
        }
        if(!$sock) {
            $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
            $this->errorCode = "-99";
            ob_end_clean();
            return false;
        }

        $response = "";
        fwrite($sock, $payload);
        stream_set_timeout($sock, $this->timeout);
        $info = stream_get_meta_data($sock);
        while ((!feof($sock)) && (!$info["timed_out"])) {
            $response .= fread($sock, $this->chunkSize);
            $info = stream_get_meta_data($sock);
        }
        fclose($sock);
        ob_end_clean();
        if ($info["timed_out"]) {
            $this->errorMessage = "Could not read response (timed out)";
            $this->errorCode = -98;
            return false;
        }

        list($headers, $response) = explode("\r\n\r\n", $response, 2);
        $headers = explode("\r\n", $headers);
        $errored = false;
        foreach($headers as $h){
            if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
                $errored = true;
                $error_code = trim(substr($h,27));
                break;
            }
        }

        if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);

        $serial = unserialize($response);
        if($response && $serial === false) {
            $response = array("error" => "Bad Response.  Got This: " . $response, "code" => "-99");
        } else {
            $response = $serial;
        }
        if($errored && is_array($response) && isset($response["error"])) {
            $this->errorMessage = $response["error"];
            $this->errorCode = $response["code"];
            return false;
        } elseif($errored){
            $this->errorMessage = "No error message was found";
            $this->errorCode = $error_code;
            return false;
        }

        return $response;
    }

    protected $function_map = array('campaignUnschedule'=>array("cid"),
'campaignSchedule'=>array("cid","schedule_time","schedule_time_b"),
'campaignScheduleBatch'=>array("cid","schedule_time","num_batches","stagger_mins"),
'campaignResume'=>array("cid"),
'campaignPause'=>array("cid"),
'campaignSendNow'=>array("cid"),
'campaignSendTest'=>array("cid","test_emails","send_type"),
'campaignSegmentTest'=>array("list_id","options"),
'campaignCreate'=>array("type","options","content","segment_opts","type_opts"),
'campaignUpdate'=>array("cid","name","value"),
'campaignReplicate'=>array("cid"),
'campaignDelete'=>array("cid"),
'campaigns'=>array("filters","start","limit","sort_field","sort_dir"),
'campaignStats'=>array("cid"),
'campaignClickStats'=>array("cid"),
'campaignEmailDomainPerformance'=>array("cid"),
'campaignMembers'=>array("cid","status","start","limit"),
'campaignHardBounces'=>array("cid","start","limit"),
'campaignSoftBounces'=>array("cid","start","limit"),
'campaignUnsubscribes'=>array("cid","start","limit"),
'campaignAbuseReports'=>array("cid","since","start","limit"),
'campaignAdvice'=>array("cid"),
'campaignAnalytics'=>array("cid"),
'campaignGeoOpens'=>array("cid"),
'campaignGeoOpensForCountry'=>array("cid","code"),
'campaignEepUrlStats'=>array("cid"),
'campaignBounceMessage'=>array("cid","email"),
'campaignBounceMessages'=>array("cid","start","limit","since"),
'campaignEcommOrders'=>array("cid","start","limit","since"),
'campaignShareReport'=>array("cid","opts"),
'campaignContent'=>array("cid","for_archive"),
'campaignTemplateContent'=>array("cid"),
'campaignOpenedAIM'=>array("cid","start","limit"),
'campaignNotOpenedAIM'=>array("cid","start","limit"),
'campaignClickDetailAIM'=>array("cid","url","start","limit"),
'campaignEmailStatsAIM'=>array("cid","email_address"),
'campaignEmailStatsAIMAll'=>array("cid","start","limit"),
'campaignEcommOrderAdd'=>array("order"),
'lists'=>array("filters","start","limit","sort_field","sort_dir"),
'listMergeVars'=>array("id"),
'listMergeVarAdd'=>array("id","tag","name","options"),
'listMergeVarUpdate'=>array("id","tag","options"),
'listMergeVarDel'=>array("id","tag"),
'listMergeVarReset'=>array("id","tag"),
'listInterestGroupings'=>array("id"),
'listInterestGroupAdd'=>array("id","group_name","grouping_id"),
'listInterestGroupDel'=>array("id","group_name","grouping_id"),
'listInterestGroupUpdate'=>array("id","old_name","new_name","grouping_id"),
'listInterestGroupingAdd'=>array("id","name","type","groups"),
'listInterestGroupingUpdate'=>array("grouping_id","name","value"),
'listInterestGroupingDel'=>array("grouping_id"),
'listWebhooks'=>array("id"),
'listWebhookAdd'=>array("id","url","actions","sources"),
'listWebhookDel'=>array("id","url"),
'listStaticSegments'=>array("id"),
'listStaticSegmentAdd'=>array("id","name"),
'listStaticSegmentReset'=>array("id","seg_id"),
'listStaticSegmentDel'=>array("id","seg_id"),
'listStaticSegmentMembersAdd'=>array("id","seg_id","batch"),
'listStaticSegmentMembersDel'=>array("id","seg_id","batch"),
'listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome"),
'listUnsubscribe'=>array("id","email_address","delete_member","send_goodbye","send_notify"),
'listUpdateMember'=>array("id","email_address","merge_vars","email_type","replace_interests"),
'listBatchSubscribe'=>array("id","batch","double_optin","update_existing","replace_interests"),
'listBatchUnsubscribe'=>array("id","emails","delete_member","send_goodbye","send_notify"),
'listMembers'=>array("id","status","since","start","limit","sort_dir"),
'listMemberInfo'=>array("id","email_address"),
'listMemberActivity'=>array("id","email_address"),
'listAbuseReports'=>array("id","start","limit","since"),
'listGrowthHistory'=>array("id"),
'listActivity'=>array("id"),
'listLocations'=>array("id"),
'listClients'=>array("id"),
'templates'=>array("types","category","inactives"),
'templateInfo'=>array("tid","type"),
'templateAdd'=>array("name","html"),
'templateUpdate'=>array("id","values"),
'templateDel'=>array("id"),
'templateUndel'=>array("id"),
'getAccountDetails'=>array("exclude"),
'getVerifiedDomains'=>array(),
'generateText'=>array("type","content"),
'inlineCss'=>array("html","strip_css"),
'folders'=>array("type"),
'folderAdd'=>array("name","type"),
'folderUpdate'=>array("fid","name","type"),
'folderDel'=>array("fid","type"),
'ecommOrders'=>array("start","limit","since"),
'ecommOrderAdd'=>array("order"),
'ecommOrderDel'=>array("store_id","order_id"),
'listsForEmail'=>array("email_address"),
'campaignsForEmail'=>array("email_address","options"),
'chimpChatter'=>array(),
'searchMembers'=>array("query","id","offset"),
'searchCampaigns'=>array("query","offset","snip_start","snip_end"),
'apikeys'=>array("username","password","expired"),
'apikeyAdd'=>array("username","password"),
'apikeyExpire'=>array("username","password"),
'ping'=>array(),
'deviceRegister'=>array("mobile_key","details"),
'deviceUnregister'=>array("mobile_key","device_id"),
'gmonkeyAdd'=>array("id","email_address"),
'gmonkeyDel'=>array("id","email_address"),
'gmonkeyMembers'=>array(),
'gmonkeyActivity'=>array());

}

?>

MCAPI.class.php:

<form  id="signup" class="formee" action="php/subscribe.php" method="post">

            <div class="form-group has-feedback">
                        <label>First Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="fname" name="fname" >
                        <label>Last Name</label>
                        <div class="clearfix"></div>
                        <input type="text" id="lname" name="lname">
                        <label>Email Address</label>
                        <div class="clearfix"></div>
                        <input type="text" id="email" name="email">
                <div class="newsletter-submit">
                        <button class="btn btn_newslatter right inputnew"  type="submit" title="Submit" value="Send" >Submit</button>
                </div>
                <div id="response"></div>

            </div>

            </form>
 <script type="text/javascript">
$(document).ready(function(a){


        // jQuery Validation
        $("#signup").validate({
            // if valid, post data via AJAX
            submitHandler: function(form) {
                $.post("php/subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
                    $('#response').html(data);
                });
            },
            // all fields are required
            rules: {
                fname: {
                    required: false
                },
                lname: {
                    required: false
                },
                email: {
                    required: true,
                    email: true
                }
            }
        });
<?php
require_once 'MCAPI.class.php';
$api = new MCAPI('xxxxxxxxxxxx');
$merge_vars = array('FNAME'=>$_POST["fname"], 'LNAME'=>$_POST["lname"]);

// Submit subscriber data to MailChimp
// For parameters doc, refer to: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
$retval = $api->listSubscribe( 'xxxxxxx', $_POST["email"], $merge_vars, 'html', false, true );

if ($api->errorCode){
    echo "<h4>Please try again.</h4>";
} else {
    echo "<h4>Thank you, you have been added to our mailing list.</h4>";
}


        // store the status message based on response code
        if ($httpCode == 200) {
            $_SESSION['msg'] = '<p style="color: #34A853">You have successfully subscribed to CodexWorld.</p>';
        } else {
            switch ($httpCode) {
                case 214:
                    $msg = 'You are already subscribed.';
                    break;
                default:
                    $msg = 'Some problem occurred, please try again.';
                    break;
            }
            $_SESSION['msg'] = '<p style="color: #EA4335">'.$msg.'</p>';
        }

?>
    <?php 
class MCAPI {
    var $version = "1.3";
    var $errorMessage;
    var $errorCode;

    /**
     * Cache the information on the API location on the server
     */
    var $apiUrl;

    /**
     * Default to a 300 second timeout on server calls
     */
    var $timeout = 300; 

    /**
     * Default to a 8K chunk size
     */
    var $chunkSize = 8192;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $api_key;

    /**
     * Cache the user api_key so we only have to log in once per client instantiation
     */
    var $secure = false;

    /**
     * Connect to the MailChimp API for a given list.
     * 
     * @param string $apikey Your MailChimp apikey
     * @param string $secure Whether or not this should use a secure connection
     */
    function MCAPI($apikey, $secure=false) {
        $this->secure = $secure;
        $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
        $this->api_key = $apikey;
    }
    function setTimeout($seconds){
        if (is_int($seconds)){
            $this->timeout = $seconds;
            return true;
        }
    }
    function getTimeout(){
        return $this->timeout;
    }
    function useSecure($val){
        if ($val===true){
            $this->secure = true;
        } else {
            $this->secure = false;
        }
    }

    /**
     * Actually connect to the server and call the requested methods, parsing the result
     * You should never have to call this function manually
     */
    function __call($method, $params) {
        $dc = "us1";
        if (strstr($this->api_key,"-")){
            list($key, $dc) = explode("-",$this->api_key,2);
            if (!$dc) $dc = "us1";
        }
        $host = $dc.".".$this->apiUrl["host"];

        $this->errorMessage = "";
        $this->errorCode = "";
        $sep_changed = false;
        //sigh, apparently some distribs change this to &amp; by default
        if (ini_get("arg_separator.output")!="&"){
            $sep_changed = true;
            $orig_sep = ini_get("arg_separator.output");
            ini_set("arg_separator.output", "&");
        }
        //mutate params
        $mutate = array();
        $mutate["apikey"] = $this->api_key;
        foreach($params as $k=>$v){
            $mutate[$this->function_map[$method][$k]] = $v;
        }
        $post_vars = http_build_query($mutate);
        if ($sep_changed){
            ini_set("arg_separator.output", $orig_sep);
        }

        $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
        $payload .= "Host: " . $host . "\r\n";
        $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
        $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
        $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
        $payload .= "Connection: close \r\n\r\n";
        $payload .= $post_vars;

        ob_start();
        if ($this->secure){
            $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
        } else {
            $sock = fsockopen($host, 80, $errno, $errstr, 30);
        }
        if(!$sock) {
            $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
            $this->errorCode = "-99";
            ob_end_clean();
            return false;
        }

        $response = "";
        fwrite($sock, $payload);
        stream_set_timeout($sock, $this->timeout);
        $info = stream_get_meta_data($sock);
        while ((!feof($sock)) && (!$info["timed_out"])) {
            $response .= fread($sock, $this->chunkSize);
            $info = stream_get_meta_data($sock);
        }
        fclose($sock);
        ob_end_clean();
        if ($info["timed_out"]) {
            $this->errorMessage = "Could not read response (timed out)";
            $this->errorCode = -98;
            return false;
        }

        list($headers, $response) = explode("\r\n\r\n", $response, 2);
        $headers = explode("\r\n", $headers);
        $errored = false;
        foreach($headers as $h){
            if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
                $errored = true;
                $error_code = trim(substr($h,27));
                break;
            }
        }

        if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);

        $serial = unserialize($response);
        if($response && $serial === false) {
            $response = array("error" => "Bad Response.  Got This: " . $response, "code" => "-99");
        } else {
            $response = $serial;
        }
        if($errored && is_array($response) && isset($response["error"])) {
            $this->errorMessage = $response["error"];
            $this->errorCode = $response["code"];
            return false;
        } elseif($errored){
            $this->errorMessage = "No error message was found";
            $this->errorCode = $error_code;
            return false;
        }

        return $response;
    }

    protected $function_map = array('campaignUnschedule'=>array("cid"),
'campaignSchedule'=>array("cid","schedule_time","schedule_time_b"),
'campaignScheduleBatch'=>array("cid","schedule_time","num_batches","stagger_mins"),
'campaignResume'=>array("cid"),
'campaignPause'=>array("cid"),
'campaignSendNow'=>array("cid"),
'campaignSendTest'=>array("cid","test_emails","send_type"),
'campaignSegmentTest'=>array("list_id","options"),
'campaignCreate'=>array("type","options","content","segment_opts","type_opts"),
'campaignUpdate'=>array("cid","name","value"),
'campaignReplicate'=>array("cid"),
'campaignDelete'=>array("cid"),
'campaigns'=>array("filters","start","limit","sort_field","sort_dir"),
'campaignStats'=>array("cid"),
'campaignClickStats'=>array("cid"),
'campaignEmailDomainPerformance'=>array("cid"),
'campaignMembers'=>array("cid","status","start","limit"),
'campaignHardBounces'=>array("cid","start","limit"),
'campaignSoftBounces'=>array("cid","start","limit"),
'campaignUnsubscribes'=>array("cid","start","limit"),
'campaignAbuseReports'=>array("cid","since","start","limit"),
'campaignAdvice'=>array("cid"),
'campaignAnalytics'=>array("cid"),
'campaignGeoOpens'=>array("cid"),
'campaignGeoOpensForCountry'=>array("cid","code"),
'campaignEepUrlStats'=>array("cid"),
'campaignBounceMessage'=>array("cid","email"),
'campaignBounceMessages'=>array("cid","start","limit","since"),
'campaignEcommOrders'=>array("cid","start","limit","since"),
'campaignShareReport'=>array("cid","opts"),
'campaignContent'=>array("cid","for_archive"),
'campaignTemplateContent'=>array("cid"),
'campaignOpenedAIM'=>array("cid","start","limit"),
'campaignNotOpenedAIM'=>array("cid","start","limit"),
'campaignClickDetailAIM'=>array("cid","url","start","limit"),
'campaignEmailStatsAIM'=>array("cid","email_address"),
'campaignEmailStatsAIMAll'=>array("cid","start","limit"),
'campaignEcommOrderAdd'=>array("order"),
'lists'=>array("filters","start","limit","sort_field","sort_dir"),
'listMergeVars'=>array("id"),
'listMergeVarAdd'=>array("id","tag","name","options"),
'listMergeVarUpdate'=>array("id","tag","options"),
'listMergeVarDel'=>array("id","tag"),
'listMergeVarReset'=>array("id","tag"),
'listInterestGroupings'=>array("id"),
'listInterestGroupAdd'=>array("id","group_name","grouping_id"),
'listInterestGroupDel'=>array("id","group_name","grouping_id"),
'listInterestGroupUpdate'=>array("id","old_name","new_name","grouping_id"),
'listInterestGroupingAdd'=>array("id","name","type","groups"),
'listInterestGroupingUpdate'=>array("grouping_id","name","value"),
'listInterestGroupingDel'=>array("grouping_id"),
'listWebhooks'=>array("id"),
'listWebhookAdd'=>array("id","url","actions","sources"),
'listWebhookDel'=>array("id","url"),
'listStaticSegments'=>array("id"),
'listStaticSegmentAdd'=>array("id","name"),
'listStaticSegmentReset'=>array("id","seg_id"),
'listStaticSegmentDel'=>array("id","seg_id"),
'listStaticSegmentMembersAdd'=>array("id","seg_id","batch"),
'listStaticSegmentMembersDel'=>array("id","seg_id","batch"),
'listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome"),
'listUnsubscribe'=>array("id","email_address","delete_member","send_goodbye","send_notify"),
'listUpdateMember'=>array("id","email_address","merge_vars","email_type","replace_interests"),
'listBatchSubscribe'=>array("id","batch","double_optin","update_existing","replace_interests"),
'listBatchUnsubscribe'=>array("id","emails","delete_member","send_goodbye","send_notify"),
'listMembers'=>array("id","status","since","start","limit","sort_dir"),
'listMemberInfo'=>array("id","email_address"),
'listMemberActivity'=>array("id","email_address"),
'listAbuseReports'=>array("id","start","limit","since"),
'listGrowthHistory'=>array("id"),
'listActivity'=>array("id"),
'listLocations'=>array("id"),
'listClients'=>array("id"),
'templates'=>array("types","category","inactives"),
'templateInfo'=>array("tid","type"),
'templateAdd'=>array("name","html"),
'templateUpdate'=>array("id","values"),
'templateDel'=>array("id"),
'templateUndel'=>array("id"),
'getAccountDetails'=>array("exclude"),
'getVerifiedDomains'=>array(),
'generateText'=>array("type","content"),
'inlineCss'=>array("html","strip_css"),
'folders'=>array("type"),
'folderAdd'=>array("name","type"),
'folderUpdate'=>array("fid","name","type"),
'folderDel'=>array("fid","type"),
'ecommOrders'=>array("start","limit","since"),
'ecommOrderAdd'=>array("order"),
'ecommOrderDel'=>array("store_id","order_id"),
'listsForEmail'=>array("email_address"),
'campaignsForEmail'=>array("email_address","options"),
'chimpChatter'=>array(),
'searchMembers'=>array("query","id","offset"),
'searchCampaigns'=>array("query","offset","snip_start","snip_end"),
'apikeys'=>array("username","password","expired"),
'apikeyAdd'=>array("username","password"),
'apikeyExpire'=>array("username","password"),
'ping'=>array(),
'deviceRegister'=>array("mobile_key","details"),
'deviceUnregister'=>array("mobile_key","device_id"),
'gmonkeyAdd'=>array("id","email_address"),
'gmonkeyDel'=>array("id","email_address"),
'gmonkeyMembers'=>array(),
'gmonkeyActivity'=>array());

}

?>

这是2.0版的API。它在新API中做了各种不好的事情


我建议这篇教程:[Misha Rudrastyh-Mailchimp使用AJAX和PHP[()

“过度关注”?我想你的意思是“覆盖”.只是学究。有人请帮帮我吗?你从MailChimp那里得到的是200 HTTP响应吗?对于成功订阅的电子邮件,它没有给出任何错误代码。我检查了MailChimp api状态并记录它说n/a,当我输入错误的电子邮件并提交时,它给出了错误代码(502)无效的电子邮件