Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

How to add 1 subscriber to multiple MailWizz (with different APIs and domains)?

$
0
0

I bought MailWizz, it's excellent. And the API is very easy to use:

https://github.com/twisted1919/mailwizz-php-sdk

https://api-docs.mailwizz.com/#subscribers-create

And what I need is to add this single subscriber to 2 different APIs, in 2 different domains. But I don't know how to do it, because I have to use only 1 setup.php file.

I simply created my HTML newsletter form with the name and email fields and directed to the save.php file with the following code:

<?php// require the setup which has registered the autoloaderrequire_once dirname(__FILE__) . '/setup.php';// CREATE THE ENDPOINT$endpoint = new MailWizzApi_Endpoint_ListSubscribers();if (!empty($_POST)) {   // CREATE / UPDATE EXISTING SUBSCRIBER   $response = $endpoint->createUpdate('id-my-list', array(    'EMAIL'  => isset($_POST['EMAIL']) ? $_POST['EMAIL'] : null,    'FNAME'  => isset($_POST['FNAME']) ? $_POST['FNAME'] : null   ));}?>

setup.php

<?php// require the autoloader class if you haven't used composer to install the packagerequire_once dirname(__FILE__) . '/MailWizzApi/Autoloader.php';// register the autoloader if you haven't used composer to install the packageMailWizzApi_Autoloader::register();// configuration object$config = new MailWizzApi_Config(array(  'apiUrl'    => 'https://site1.com/mailwizz/api/',  'publicKey'   => '0000000',  'privateKey'  => '11111111',   // components  'components' => array(    'cache' => array(      'class'   => 'MailWizzApi_Cache_File',      'filesPath' => dirname(__FILE__) . '/MailWizzApi/Cache/data/cache', // make sure it is writable by webserver     )   ),));// now inject the configuration and we are ready to make api callsMailWizzApi_Base::setConfig($config);// start UTCdate_default_timezone_set('UTC');?>

I have 2 API

'apiUrl' => 'https://site1.com/mailwizz/api/','publicKey' => '0000000','privateKey' => '11111111',and'apiUrl' => 'https://other-site2.com/mailwizz-new/api/','publicKey' => '22222222','privateKey' => '333333333',

Thanks.


Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>