$api = new MCAPI($apikey);
//================== Pipelinedeals.com  =====================
require_once 'PDAdapter.php';
$conditions = null;
$page = null;
$_postback = null;
$api_key = 'xxxxxxxxxxxxxxxxxxxxx';
// Enter your API key from Pipelinedeals
$pda = new PDAdapter($api_key);
//================== get data from Pipelinedeals ======================
$lead_sources = array(200344, 443356, 528827);
// Put details that you want to select from Pipelinedeals
$resources = "people";
$conditions['person_type'] = 'Lead';
// for instance "Lead"
$pda->setMethod('get');
$result = $pda->doRequest($resources, $conditions, $page, $_postback);
$pages = 3;
// $result['pagination']['pages'];
$stack = array();
if ($pages > 0) {
    foreach ($lead_sources as $type) {
        $conditions['lead_source'] = $type;
        for ($i = 1; $i <= $pages; $i++) {
            $result = $pda->doRequest($resources, $conditions, $i, $_postback);
            foreach ($result['entries'] as $entry) {
                // select the range of date that you want to filter and to send MailChimp
                if (strtotime('2015-12-31 00:00:00') > strtotime($entry['created_at']) && strtotime($entry['created_at']) > strtotime('2015-01-01 00:00:00')) {
                    array_push($stack, array('email' => $entry['email'], 'person_id' => $entry['id'], 'first_name' => $entry['first_name'], 'last_name' => $entry['last_name']));
                }
            }
$_postback['person[company_name]'] = "Test Company";
$_postback['person[custom_fields[custom_label_1009214]]'] = "custom_label_first_section";
$_postback['person[custom_fields[custom_label_1018289]]'] = "828733";
$_postback['person[custom_fields[custom_label_1038041]]'] = "877127";
$_postback['person[custom_fields[custom_label_1038048]]'] = "877130";
$_postback['person[custom_fields[custom_label_1038049]]'] = "20150620";
$_postback['person[custom_fields[custom_label_1041539]]'] = "885395";
$_postback['person[custom_fields[custom_label_1071910]]'] = "967057";
//=========== some details for using 'notes' ==============
$note['note[person_id]'] = '1039959805';
$note['note[user_id]'] = '19095';
$note['note[note_category_id]'] = '144576';
$note['note[content]'] = 'This is TEST comment';
//================= for creating ===========================
$resources = "people";
$pda->setMethod('post');
//create
$result = $pda->doRequest($resources, $conditions, $page, $_postback);
// $_postback or $note ...
//================= for getting ============================
$resources = "people/" . $people_id;
// $people_id -> some person id (for instance 12854350) that you want to get
$pda->setMethod('get');
//get
$result = $pda->doRequest($resources, $conditions, $page, $_postback);
// $_postback or $note ...
//================= for updating ============================
$resources = "people/" . $people_id;
// $people_id -> some person id (for instance 12854350) that you want to update
$pda->setMethod('put');
//update