function fncAmocrmCheckTag($strLeadTag, $strLeadId, $arrIdsResponsible, $arrAmocrmIdsResponsibleDisable, $strCookieFile) { $countUpdated = 0; //число update контактов $strnewline = ' ================================ '; @file_put_contents(AMOCRM_LOG_FILE, 'Start fncAmocrmCheckTag' . $strnewline); # пытаемся авторизироваться в amoCRM $arrAmocrmAuth = fncAmocrmAuth(AMOCRM_LOGIN, AMOCRM_SUBDOMAIN, AMOCRM_API_KEY, $strCookieFile); if (!$arrAmocrmAuth['boolOk']) { # $arrAmocrmAuth['strErrDevelopUtf8'] } else { $idNextResponsible = fncGetIdNextResponsible($arrIdsResponsible, $strFwritePath); $arrLeadData = fncAmocrmLeadsGetById(AMOCRM_SUBDOMAIN, $strCookieFile, $strLeadId); if (!$arrLeadData['boolOk']) { } else { $arrTags = $arrLeadData['arrResponse']['leads'][0]['tags']; @file_put_contents(AMOCRM_LOG_FILE, "Ищем тэг:" . $strLeadTag . $strnewline, FILE_APPEND); foreach ($arrTags as $subarrtag) { if ($subarrtag['name'] == $strLeadTag) { //нужный тэг найден $countUpdated = 1; } else { @file_put_contents(AMOCRM_LOG_FILE, "tags:" . $subarrtag['name'] . $strnewline, FILE_APPEND); } } } } return $countUpdated; //return $idNextResponsible; }
<html> <head> <title>hook</title> </head> <body> <?php @(include_once 'amoCRM_include.php'); if (function_exists('fncAmocrmTextiloptomRegForm')) { $var = fncGetIdNextResponsible($arrAmocrmIdsResponsible, ""); } echo "varr: " . $var; ?> </body> </html>