Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I had the same problem.. I did a quick fix by myself and It’s working now.

    This is the function that I changed:

    function mc4wp_get_request_ip_address() {
        $ip = null;
        if ( isset( $_SERVER['X-Forwarded-For'] ) ) {
            $ip = $_SERVER['X-Forwarded-For'];
        }
    
        if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
    
        if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
    
        $pos = strpos($ip,":");
        if ($pos === false) {
            return $ip;
        }else{
            return substr($ip,0,$pos-1);
        }
    }

    Hello,

    In my case the site uses WAF and the IP has a port. I think that’s why the error keeps appearing.

    [2022-09-07 17:44:21] ERROR: Contact Form 7 > Mailchimp API Error: Bad Request. Invalid Resource. The resource submitted could not be validated.
    - ip_signup : This value is not a valid IP. Valid IPs have a format of W.X.Y.Z where each letter represents a number between 0-255.
    Request:
    POST https://us5.api.mailchimp.com/3.0/lists/27e74966f3/members
    {"status":"subscribed","email_address":"test**@gm***.com","interests":{},"merge_fields":{"FNAME":"Test","LNAME":"Test"},"email_type":"html","ip_signup":"186.4.253.30:61458","tags":[]}
    Response:
    400 Bad Request
    {"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"d67831b6-3334-58fb-003a-47a8675878ae","errors":[{"field":"ip_signup","message":"This value is not a valid IP. Valid IPs have a format of W.X.Y.Z where each letter represents a number between 0-255."}]}
Viewing 2 replies - 1 through 2 (of 2 total)