api update subscriber

Frank

New Member
I'm figuring out how to update a subscriber using the API, but I got error Forbidden

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...
 
What is the actual code url of the api? Are you sure there's nothing on the server that prevents remote post requests? (like apache's mod_security) ?
 
try now...i was trying to figure out the problem and i chmod the folder api 0777, now i set it back, no errors, just []
 
Back
Top