<?php if ($_SERVER['REQUEST_URI'] == '/amocrm.php') { echo "<h1>Локальный запуск скрипта</h1>"; auth_amocrm(); //$tasks_list = tasks_list_amocrm('375297077985'); //$contacts_list = contacts_list_amocrm('375447099000'); //$contacts_list = contacts_list_amocrm('7077985'); //print_r($contacts_list); //leads_list_amocrm('7077985'); //leads_list_amocrm('', '31747809'); /*$contact_id = 60605761; echo "Пробегаем по всем сделкам контакта $contact_id <br>"; $leads_arr = contacts_links_amocrm($contact_id); foreach($leads_arr['links'] as $link) { echo "<h2>$link[lead_id] </h2><br>"; $leads_list = leads_list_amocrm('', $link['lead_id']); $lead_info = $leads_list['leads'][0]; print_r($lead_info); if(strstr($lead_info['name'],"Спарта [22.05.2015]") && $lead_info['price']=="550") { echo "Повторная заявка <br>"; return false; } }/**/ //echo "Новая заявка <br>"; //contacts_links_amocrm('60587063'); //notes_list_amocrm('', 'contact'); //notes_list_amocrm('', 'lead'); //notes_add_amocrm('29823171', "Первый коментарий"); } // Авторизуемся через API function auth_amocrm()
require_once 'Mailchimp.php'; $api_key = "d361c34017d6a76d6d2f5b001d2e3212-us11"; //replace with your API key $list_id = "2f67f73156"; //replace with the list id you're adding the email to // set up our mailchimp object, and list object $Mailchimp = new Mailchimp($api_key); $Mailchimp_Lists = new Mailchimp_Lists($Mailchimp); try { $subscriber = $Mailchimp_Lists->subscribe($list_id, array('email' => $email)); //pass the list id and email to mailchim } catch (Exception $e) { } die; } if (auth_amocrm()) { $prod_name = "Д3m design.ivanprotsko.by"; $manager = '134230'; if ($phone == '') { $leads_id_arr = array(); $contacts_id_arr = contacts_add_no_phone($name, $email); notes_add_amocrm($contacts_id_arr[0], $message, 1); } else { $contacts_list = contacts_list_amocrm(substr($phone_num, strlen($phone_num) - 7, 7)); if ($contacts_list === false) { // нету, создаём $leads_id_arr = leads_add_amocrm($prod_name, $name, $manager); if ($email == '') { $contacts_id_arr = contacts_add_no_email($name, $phone, $leads_id_arr); } else { $contacts_id_arr = contacts_add_amocrm($name, $phone, $email, $leads_id_arr);