• Resolved ookris

    (@ookris)


    I followed the description at https://kb.mailpoet.com/article/195-add-subscribers-through-your-own-form-or-plugin but unfortunately adding subscribers does not work.
    My code looks like this

    
    <?php 
    
    subscriber_data = array(
       'email' => $_GET['email'],
       'first_name' => $_GET['first_name'],
       'last_name' => $_GET['last_name']
    );
     
    $lists = 3;
    
    try {
       $subscriber = \MailPoet\API\API::MP('v1')->addSubscriber($subscriber_data, $lists, $options);
    } catch(Exception $exception) {
       // return $exception->getMessage();
    }
    
    echo print_r($subscriber_data, TRUE);
     
    ?>
    

    The script is called like this

    https://bolecair.info/wp-content/uploads/mailpoet/[email protected]&first_name=Name&last_name=LName

    What is wrong?

    • This topic was modified 5 years, 6 months ago by ookris.
    • This topic was modified 5 years, 6 months ago by ookris.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to use API’ is closed to new replies.