PHP code example of mfajfr / datacollection-api

1. Go to this page and download the library: Download mfajfr/datacollection-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mfajfr / datacollection-api example snippets


define('URL', 'https://datacollection.xample');
define('API_TOKEN', '1234567890123456789012345678901234567890');

Connection::setConfiguration(new Configuration(URL, API_TOKEN));

$subscriber = Subscriber::example(); // Create example subscriber (fake data)
$subscriber->store(); // Storing subscriber

$subscriber = Subscriber::findByListAndAccountId($subscriber->list, $subscriber->account_id)['subscriber']; // Finding subscriber

$subscriber->email = 'new' . $subscriber->email; // Set new property

$subscriber->updateByListAndAccountId(); // Updating subscriber