Frank
New Member
I'm figuring out how to update a subscriber using the API, but I got error Forbidden
This is my code
First I get the subscriber uid using the email (the code is working at this point), and then update it but here I got stucked...
Code:
MailWizzApi_Params Object
(
[_data:MailWizzApi_Params:private] => Array
(
[status] => error
[error] => Forbidden
)
[_readOnly:MailWizzApi_Params:private] =>
)
This is my code
PHP:
$email = $input->get->email;
require_once './MailWizzApi/Autoloader.php';
MailWizzApi_Autoloader::register();
$configM = new MailWizzApi_Config(array(
'apiUrl' => 'http://domain/api/',
'publicKey' => 'xxx',
'privateKey' => 'xxx',
'components' => array(
'cache' => array(
'class' => 'MailWizzApi_Cache_File',
'filesPath' => './MailWizzApi/Cache/data/cache',
)
),
));
MailWizzApi_Base::setConfig($configM);
date_default_timezone_set('UTC');
$listUid = 'xxxxx';
$endpoint = new MailWizzApi_Endpoint_ListSubscribers();
$response = $endpoint->emailSearch($listUid, $email);
$response = $response->body;
$uid = $response->itemAt('data');
$uid = $uid['subscriber_uid'];
$response = $endpoint->update($listUid, $uid, array(
'PRODOTTO' => 'xxxxx'
));
$response = $response->body;
print_r($response);
First I get the subscriber uid using the email (the code is working at this point), and then update it but here I got stucked...