As I cannot make the creation of subscribers work in node (https://forum.mailwizz.com/threads/...post-requests-allowed-for-this-endpoint.9135/), I would like to try it in PHP.
In the terminal of my local Mac, I installed the SDK by `composer require ems-api/php-client`, then modified `vendor/ems-api/php-client/example/setup.php` as follows.
In the terminal, `php vendor/ems-api/php-client/example/setup.php` returned the follows. `test-ulm9bj7dh@srv1.mail-tester.com` is the only one existing subscriber in the list. So, it means `softtimur@gmail.com` was not added. I don't see `softtimur@gmail.com` in the list on the website of MailWizz either. Does anyone know what can be the cause?
In the terminal of my local Mac, I installed the SDK by `composer require ems-api/php-client`, then modified `vendor/ems-api/php-client/example/setup.php` as follows.
PHP:
<?php
// exit('COMMENT ME TO TEST THE EXAMPLES!');
// require_once __DIR__ . '/../vendor/autoload.php';
require 'vendor/autoload.php';
// configuration object
$config = new \EmsApi\Config([
'apiUrl' => 'http://mail.mycompany.com/api',
'apiKey' => 'key',
// components
'components' => [
'cache' => [
'class' => \EmsApi\Cache\File::class,
'filesPath' => __DIR__ . '/data/cache', // make sure it is writable by webserver
]
],
]);
// now inject the configuration and we are ready to make api calls
\EmsApi\Base::setConfig($config);
// start UTC
date_default_timezone_set('UTC');
// CREATE THE ENDPOINT
$endpoint = new EmsApi\Endpoint\ListSubscribers();
// ADD SUBSCRIBER
$response = $endpoint->create('tb104q03l4224', [
'EMAIL' => 'softtimur@gmail.com', // the confirmation email will be sent!!! Use valid email address
]);
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
// CREATE / UPDATE EXISTING SUBSCRIBER
$response = $endpoint->createUpdate('tb104q03l4224', [
'EMAIL' => 'softtimur@gmail.com'
]);
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
In the terminal, `php vendor/ems-api/php-client/example/setup.php` returned the follows. `test-ulm9bj7dh@srv1.mail-tester.com` is the only one existing subscriber in the list. So, it means `softtimur@gmail.com` was not added. I don't see `softtimur@gmail.com` in the list on the website of MailWizz either. Does anyone know what can be the cause?
Code:
<hr /><pre>EmsApi\Params Object
(
[_data:EmsApi\Paramsrivate] => Array
(
[status] => success
[data] => Array
(
[count] => 1
[total_pages] => 1
[current_page] => 1
[next_page] =>
[prev_page] =>
[records] => Array
(
[0] => Array
(
[subscriber_uid] => sg0748rt2l465
=> test-ulm9bj7dh@srv1.mail-tester.com
[FNAME] =>
[LNAME] =>
[status] => confirmed
[source] => web
[ip_address] => 103.47.100.216
[date_added] => 2024-01-31 13:31:03
)
)
)
)
[_readOnly:EmsApi\Paramsrivate] =>
)
</pre><hr /><pre>EmsApi\Params Object
(
[_data:EmsApi\Paramsrivate] => Array
(
[status] => success
[data] => Array
(
[count] => 1
[total_pages] => 1
[current_page] => 1
[next_page] =>
[prev_page] =>
[records] => Array
(
[0] => Array
(
[subscriber_uid] => sg0748rt2l465
[EMAIL] => test-ulm9bj7dh@srv1.mail-tester.com
[FNAME] =>
[LNAME] =>
[status] => confirmed
[source] => web
[ip_address] => 103.47.100.216
[date_added] => 2024-01-31 13:31:03
)
)
)
)
[_readOnly:EmsApi\Paramsrivate] =>
)
</pre>%
Last edited: