{"id":337619,"date":"2022-08-27T21:00:20","date_gmt":"2022-08-27T21:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=337619"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=337619","title":{"rendered":"<span>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043a\u0430\u0437\u0430 c \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a\u0430 \u0432 CRM (\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0442\u043e\u0440\u0430)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/e81\/82f\/37e\/e8182f37e0effc95c082c6168f4f7424.jpg\" width=\"1280\" height=\"904\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e81\/82f\/37e\/e8182f37e0effc95c082c6168f4f7424.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. <br \/>\u041a\u043b\u0438\u0435\u043d\u0442\u044b \u0437\u0432\u043e\u043d\u044f\u0442 \u0432 \u043d\u0435\u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043d\u0430 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a \u0438 \u0434\u0438\u043a\u0442\u0443\u044e\u0442 \u043d\u0430 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a \u0437\u0430\u043a\u0430\u0437.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430\u0445 \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b\u044b \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0430\u0437 \u0432 CRM. \u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0430\u0443\u0434\u0438\u043e \u0432 \u0442\u0435\u043a\u0441\u0442 (\u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044f)<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/297\/212\/81d\/29721281d3026c1ac821943b6ba71e8a.jpg\" alt=\"\" title=\"\" width=\"480\" height=\"320\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/297\/212\/81d\/29721281d3026c1ac821943b6ba71e8a.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 Yandex Speech Kit.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 Yandex Speech Kit<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>\/\/ $token \u2013 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \/\/ $audioFileName \u2013 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u0430\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0435\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ogg $file = fopen($audioFileName, 'rb');  $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, \"https:\/\/stt.api.cloud.yandex.net\/speech\/v1\/stt:recognize?lang=ru-RU&amp;format=oggopus\"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Api-Key ' . $token, 'Transfer-Encoding: chunked')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);  curl_setopt($ch, CURLOPT_INFILE, $file); $res = curl_exec($ch); curl_close($ch); $decodedResponse = json_decode($res, true); if (isset($decodedResponse[\"result\"])) { $text = urlencode($decodedResponse[\"result\"]); } else { echo \"Error code: \" . $decodedResponse[\"error_code\"] . \"\\r\\n\"; echo \"Error message: \" . $decodedResponse[\"error_message\"] . \"\\r\\n\"; }  fclose($file);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0435\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $text. <\/p>\n<h2>\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u044b\u0441\u043b\u043e\u0432<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/9d5\/0dc\/4cf\/9d50dc4cfc6beb3d633d44a1bb3ed91d.jpg\" alt=\"\" title=\"\" width=\"480\" height=\"252\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d5\/0dc\/4cf\/9d50dc4cfc6beb3d633d44a1bb3ed91d.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. <br \/>\u0412 \u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u2013 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0449\u0435\u043c, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2013 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0442\u043e\u0432\u0430\u0440\u0430:<\/p>\n<pre><code>$name_dataset = array(\"\u043c\u044f\u0433\u043a\\D{2}\", \"\u043f\u0440\u0438\u0440\u043e\u0434\u043d\\D{2}\" ); $name_dataset_correct = array(\"\u0421\u0435\u0441\u0442\u0440\u0438\u0446\u0430 \u041c\u044f\u0433\u043a\u0430\u044f\", \"\u041f\u0440\u0438\u0440\u043e\u0434\u043d\u0430\u044f\" );<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c \u0438\u0449\u0435\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 $string:<\/p>\n<pre><code>$name = ''; foreach ($name_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";       if (preg_match($pattern, $string, $matches_quantity_1)) {         $name = $name_dataset_correct[$key];         }     }   if ($name == '') {$name = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}<\/code><\/pre>\n<p>\u0421 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>$quantity = ''; $quantity_dataset = array(\"\u0431\u0443\u0442\u044b\u043b\\D+ \u0432\u043e\u0434\u044b\", \"\u0431\u0443\u0442\u044b\u043b\u043e\u0447\\D{1,2}\", \"\u0431\u0443\u0442\u044b\u043b\\D{1,2}\", \"\u0448\u0442\u0443\\D+ \u0432\u043e\u0434\u044b\", \"\u0448\u0442\u0443\u0447\u0435\\D{0,2}\u043a\", \"\u0448\u0442\u0443\u043a\\D{0,1}\"); foreach ($quantity_dataset as $find) {     $pattern = \"\/\\d+ $find\/ui\";       if (preg_match($pattern, $string_new, $matches_quantity_1)) {                 preg_match(\"\/\\d+\/\", $matches_quantity_1[0], $matches_quantity_2);         $quantity = $matches_quantity_2[0];         }      }     if ($quantity == '') {$quantity = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}    $interval = \"\";  $interval_dataset = array(\"\u043a \u0443\u0442\u0440\u0443\", \"\u0443\u0442\u0440\u043e\u043c\", \"\\D{0,2} \u0443\u0442\u0440\u043e\", \"\u043a \u0432\u0435\u0447\u0435\u0440\u0443\", \"\u0432\u0435\u0447\u0435\u0440\u043e\u043c\", \"\\D{0,2} \u0432\u0435\u0447\u0435\u0440\", \"\u0434\u043e \u043e\u0431\u0435\u0434\u0430\", \"\u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430\",   \"\\D{1,2} 1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \u0434\u043d\u044f\", \"\\D{1,2} 1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1}\", \"1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \\D{0,3}\", \"\\D{1,2} 2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \u0434\u043d\u044f\", \"\\D{1,2} 2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1}\",   \"2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \\D{0,3}\", \"\u0441 15 \u0447\u0430\u0441\u043e\u0432\", \"\u0441 15 \u0434\u043e 18\", \"\u0441 18 \u0434\u043e 21\", \"\u0441 18 \u0434\u043e 22\", \"\u0441 18 \u0447\u0430\u0441\u043e\u0432\", \"\u0441 18\", \"\u043f\u043e\u0441\u043b\u0435 18 \u0447\u0430\u0441\u043e\u0432\", \"\u043f\u043e\u0441\u043b\u0435 18\", \"18 0 0\");        $interval_dataset_correct = array(\"\u0443\u0442\u0440\u043e\", \"\u0443\u0442\u0440\u043e\", \"\u0443\u0442\u0440\u043e\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0434\u043e \u043e\u0431\u0435\u0434\u0430\", \"\u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430\",   \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\",   \"\u0441 15 \u0434\u043e 18-00\", \"\u0441 15 \u0434\u043e 18-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\",   \"\u0441 18 \u0434\u043e 22-00\");  $interval = \"\"; foreach ($interval_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";     if (preg_match($pattern, $string_new, $matches_quantity_1)) {         $interval = $interval.\" \".$interval_dataset_correct[$key];         }      }   if ($interval == '') {$interval = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430 ($name), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ($quantity) \u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 ($interval).<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u0434\u043e\u0432\u044b\u0435 \u0438\u043b\u0438 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u0438 \u043a\u043e\u0434\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>$stop_dataset = array(\"\u043e\u0442\u043c\u0435\u043d\\D{1,3}\", \"2 \u0437\u0430\u043a\u0430\u0437\u0430\", \"\u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\");  $stop_dataset_real = array(\"\u043e\u0442\u043c\u0435\u043d\u0430\", \"\u0414\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\", \"\u0414\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\");  $stop = false; foreach ($stop_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";       if (preg_match($pattern, $string, $matches_quantity_1)) {         $stop_world = $stop_dataset_real[$key];                }      else { }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u043e\u0442\u043c\u0435\u043d\u0443 \u0437\u0430\u043a\u0430\u0437\u0430 \u0438\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u0442\u0440\u0435\u0432\u043e\u0436\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435&#187; \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c.<\/p>\n<h2>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/5e0\/f6f\/749\/5e0f6f749b1d2d3af36361ee2203e287.jpg\" alt=\"\" title=\"\" width=\"480\" height=\"227\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5e0\/f6f\/749\/5e0f6f749b1d2d3af36361ee2203e287.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f CRM \u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0432 CRM \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 dadata.<\/p>\n<pre><code>    $token = \"\u0412\u0410\u0428_API_\u041a\u041b\u042e\u0427\";     $secret = \"\u0412\u0410\u0428_\u0421\u0415\u041a\u0420\u0415\u0422\u041d\u042b\u0419_\u041a\u041b\u042e\u0427\";     $city=\"\u0417\u0410\u0414\u0410\u0415\u041c \u0413\u041e\u0420\u041e\u0414\";      $dadata = new Dadata($token, $secret);     $dadata->init();     $result = $dadata->clean(\"address\", $city.\" \".$string_new);     $address = $result[0][\"result\"];     $quality_cod = result[0][\"qc\"];     $dadata->close();<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0434 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0430\u0434\u0440\u0435\u0441. <br \/>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 $string_new, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c. <br \/>\u0410\u0434\u0440\u0435\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $address. <br \/>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u043e\u0434 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 ($quality_cod). <\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 class Dadata<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>class TooManyRequests extends Exception { }  class Dadata {     private $clean_url = \"https:\/\/cleaner.dadata.ru\/api\/v1\/clean\";     private $suggest_url = \"https:\/\/suggestions.dadata.ru\/suggestions\/api\/4_1\/rs\";     private $token;     private $secret;     private $handle;      public function __construct($token, $secret)     {         $this->token = $token;         $this->secret = $secret;     }      \/*      * Initialize connection.      *\/           public function init()     {         $this->handle = curl_init();         curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);         curl_setopt($this->handle, CURLOPT_HTTPHEADER, array(             \"Content-Type: application\/json\",             \"Accept: application\/json\",             \"Authorization: Token \" . $this->token,             \"X-Secret: \" . $this->secret,         ));         curl_setopt($this->handle, CURLOPT_POST, 1);     }      \/*      * Clean service.      * See for details:      *   - https:\/\/dadata.ru\/api\/clean\/address      *   - https:\/\/dadata.ru\/api\/clean\/phone      *   - https:\/\/dadata.ru\/api\/clean\/passport      *   - https:\/\/dadata.ru\/api\/clean\/name      *       * (!) This is a PAID service. Not included in free or other plans.      *\/           public function clean($type, $value)     {         $url = $this->clean_url . \"\/$type\";         $fields = array($value);         return $this->executeRequest($url, $fields);     }       \/*      * Close connection.      *\/           public function close()     {         curl_close($this->handle);     }      private function executeRequest($url, $fields)     {         curl_setopt($this->handle, CURLOPT_URL, $url);         if ($fields != null) {             curl_setopt($this->handle, CURLOPT_POST, 1);             curl_setopt($this->handle, CURLOPT_POSTFIELDS, json_encode($fields));         } else {             curl_setopt($this->handle, CURLOPT_POST, 0);         }         $result = $this->exec();         $result = json_decode($result, true);         return $result;     }      private function exec()     {         $result = curl_exec($this->handle);         $info = curl_getinfo($this->handle);         if ($info['http_code'] == 429) {             throw new TooManyRequests();         } elseif ($info['http_code'] != 200) {             throw new Exception('Request failed with http code ' . $info['http_code'] . ': ' .              $result);         }         return $result;     }<\/code><\/pre>\n<pre><code>public function __construct($token, $secret) {     $this->token = $token;     $this->secret = $secret; }  \/*  * Initialize connection.  *\/   public function init() {     $this->handle = curl_init();     curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);     curl_setopt($this->handle, CURLOPT_HTTPHEADER, array(         \"Content-Type: application\/json\",         \"Accept: application\/json\",         \"Authorization: Token \" . $this->token,         \"X-Secret: \" . $this->secret,     ));     curl_setopt($this->handle, CURLOPT_POST, 1); }  \/*  * Clean service.  * See for details:  *   - https:\/\/dadata.ru\/api\/clean\/address  *   - https:\/\/dadata.ru\/api\/clean\/phone  *   - https:\/\/dadata.ru\/api\/clean\/passport  *   - https:\/\/dadata.ru\/api\/clean\/name  *   * (!) This is a PAID service. Not included in free or other plans.  *\/   public function clean($type, $value) {     $url = $this->clean_url . \"\/$type\";     $fields = array($value);     return $this->executeRequest($url, $fields); }   \/*  * Close connection.  *\/   public function close() {     curl_close($this->handle); }  private function executeRequest($url, $fields) {     curl_setopt($this->handle, CURLOPT_URL, $url);     if ($fields != null) {         curl_setopt($this->handle, CURLOPT_POST, 1);         curl_setopt($this->handle, CURLOPT_POSTFIELDS, json_encode($fields));     } else {         curl_setopt($this->handle, CURLOPT_POST, 0);     }     $result = $this->exec();     $result = json_decode($result, true);     return $result; }  private function exec() {     $result = curl_exec($this->handle);     $info = curl_getinfo($this->handle);     if ($info['http_code'] == 429) {         throw new TooManyRequests();     } elseif ($info['http_code'] != 200) {         throw new Exception('Request failed with http code ' . $info['http_code'] . ': ' .          $result);     }     return $result; } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0435\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 CRM.<\/p>\n<h2>\u0423\u043b\u0443\u0447\u0448\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0434\u0440\u0435\u0441\u0430<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0440\u0430\u0437\u0443 \u0436\u0435, \u0442\u043e \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e, \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 \u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043d\u043e \u0438\u043b\u0438 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0430\u0434\u0440\u0435\u0441\u0443.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0438 \u043f\u0440\u043e\u0449\u0430\u043d\u0438\u044f:<\/p>\n<pre><code>$hallo_resize = array(\"\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\\D{0,2}\", \"\u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\\D{1,2}\", \"\u043f\u0440\u0438\u0432\u0435\u0442\", \"\u0434\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c\", \"\u0434\u043e\u0431\u0440\u043e\\D{1,2} \u0443\u0442\u0440\\D{1}\", \"\u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0434\u043d\u044f\",  \"\u0434\u043e\u0431\u0440\\D{2,3} \u0432\u0435\u0447\u0435\u0440\\D{0,1}\", \"\u0434\u043e\u0431\u0440\\D{2,3} \u0432\u0435\u0447\u0435\u0440\\D{2}\", \"\u0434\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f\", \"\u0432\u0441\u0435\u0433\u043e \u0434\u043e\u0431\u0440\u043e\u0433\u043e\", \"\u0432\u0441\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u043e\u0431\u0440\u043e\u0433\u043e\", \"\u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e\", \"\u0432\u0441\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435\u0433\u043e\",  \"\u0432\u0441\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435\u0433\u043e\", \"\u0432\u0441\u0435\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e\", \u0432\u0441\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e\", \"\u0441\u043f\u0430\u0441\u0438\u0431\u043e.\");  foreach ($hallo_resize as $value) {     $pattern = \"\/$value\/ui\";     $string_new = preg_replace($pattern, '', $string_new);     }<\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>$another_resize = array(\"\\b\u043d\u0443\u0436\u043d\u043e\\b\", \"\u043c\u043d\u0435 \u0431\u044b\", \"\\b\u043c\u043d\u0435\\b\", \"\u0441\u043f\u0430\u0441\u0438\u0431\u043e\", \"\\b\u0430\u0434\u0440\u0435\u0441\\D{0,1}\\b\", \"\\b\\D\u043e\u0441\u0442\u0430\u0432\u043a\\D{1,2}\\b\", \"\u0441\u0434\u0435\u043b\u0430\u0442\u044c\",      \"\\b\u0437\u0430\u043a\u0430\u0437\\D{0,2}\u0430\u0442\u044c\\b\", \"\u043f\u043e \u0437\u0430\u043a\u0430\u0437\\D{0,2}\u0443\", \"\u043f\u0440\u043e \u0437\u0430\u043a\u0430\u0437\\D{0,2}\", \"\\b\u0437\u0430\u043a\u0430\u0437\u0438\u043aD{0,1}\\b\", \"\\b\u0437\u0430\u043a\u0430\u0437D{0,1}\\b\",     \"\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e\", \"\u043f\u0440\u043e\u0448\u0443\", \"\u043f\u0440\u0438\u043c\u0438\u0442\u0435\", \"\u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430\", \"\u0445\u043e\u0447\u0443\", \"\\b\u044f\\b\", \"\\b\u0432\u044b\\b\",  \"\\b\u043c\u044b\\b\",  \"\\b\u0432\u0441\u0435\\b\", \"\u0430\u043b\u043b\u043e\", \"\u0431\u0443\u0434\u0443 \u0434\u043e\u043c\u0430\", \"\u0432\u0440\u0435\u043c\u044f\",      \"\\b\u0432\u043e\u0442\\b\", \"\\b\u0443\u0436\u0435\\b\", \"\\b\u0432\u0430\u043c\\b\", \"\\b\u0437\u0432\u043e\u043d\\D{1,2}\\b\", \"\\b\u0436\u0438\u0432\u043e\u0439\\b\",      \"\\b\u0433\u043e\u043b\u043e\u0441\\b\", \"\u0443\u0437\u043d\u0430\\D{1,2}\", \"\\b\u043f\u0440\u0438\u043d\u044f\\D{1,2}\\b\", \"\\b\u043c\u043e\u0439\\b\", \"\\b\u043c\u043e\u0436\u043d\u043e\\b\", \"\\b\u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c\\b\", \"\\b\u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a\\D{1,2}\\b\");      foreach ($another_resize as $value) {     $pattern = \"\/$value\/ui\";     $string_new = preg_replace($pattern, '', $string_new);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u043a\u043e\u0434\u0430, \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u0430\u0443\u0434\u0438\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $text, \u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 $string_new,<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u043e\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0434\u0440\u0435\u0441\u0430, \u0430 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043c\u044b\u0441\u043b\u043e\u0432, \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0447\u043d\u0435\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u0418 \u0441\u043e\u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0430\u0434\u0440\u0435\u0441\u0443, \u043d\u043e \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u043a \u0441\u043c\u044b\u0441\u043b\u0430\u043c<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>   $finresize_dataset = array(     \"\\d{1,2} \u0447\u0438\u0441\u043b\\D{1,2}\",      \"\u0441 \\d{1,2} \u0447\u0430\u0441\u043e\u0432\", \"\u0441 \\d{1,2}\\b\", \"\u0434\u043e \\d{1,2} \u0447\u0430\u0441\u043e\u0432\", \"\u0434\u043e \\d{1,2}\\b\", \"\u043a \\d{1,2} \u0447\u0430\u0441\u0430\u043c\", \"\u043a \\d{1,2}\\b\", \"\u043f\u043e\u0441\u043b\u0435 \\d{1,2} \u0447\u0430\u0441\u043e\u0432\", \"\u043f\u043e\u0441\u043b\u0435 \\d{1,2}\\b\",     \"\\D{0,2} \u0441\u0435\u0433\u043e\u0434\u043d\u044f\", \"\\D{0,2} \u0437\u0430\u0432\u0442\u0440\u0430\",     \"\\D{1,2} \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\\D{0,1}\", \"\\D{1,2} \u0432\u0442\u043e\u0440\u043d\u0438\u043a\\D{0,1}\", \"\\D{1,2} \u0441\u0440\u0435\u0434\\D{1}\", \"\\D{1,2} \u0447\u0435\u0442\u0432\u0435\u0440\u0433\\D{0,1}\", \"\\D{1,2} \u043f\u044f\u0442\u043d\u0438\u0446\\D{1}\", \"\\D{1,2} \u0441\u0443\u0431\u0431\u043e\u0442\\D{1}\", \"\\D{1,2} \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\\D{1}\",      \"\\D{1,2} \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u0438\\D{1}\",      \"\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\", \"\u0432\u0442\u043e\u0440\u043d\u0438\u043a\", \"\u0441\u0440\u0435\u0434\u0430\", \"\u0447\u0435\u0442\u0432\u0435\u0440\u0433\", \"\u043f\u044f\u0442\u043d\u0438\u0446\u0430\", \"\u0441\u0443\u0431\u0431\u043e\u0442\u0430\", \"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435\", \"\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u0438\u0435\",     \"\\d{1,2} \u044f\u043d\u0432\u0430\u0440\u044f\", \"\\d{1,2} \u0444\u0435\u0432\u0440\u0430\u043b\u044f\", \"\\d{1,2} \u043c\u0430\u0440\u0442\u0430\", \"\\d{1,2} \u0430\u043f\u0440\u0435\u043b\u044f\", \"\\d{1,2} \u043c\u0430\u044f\", \"\\d{1,2} \u0438\u044e\u043d\u044f\", \"\\d{1,2} \u0438\u044e\u043b\u044f\", \"\\d{1,2} \u0430\u0432\u0433\u0443\u0441\u0442\u0430\", \"\\d{1,2} \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f\",      \"\\d{1,2} \u043e\u043a\u0442\u044f\u0431\u0440\u044f\", \"\\d{1,2} \u043d\u043e\u044f\u0431\u0440\u044f\", \"\\d{1,2} \u0434\u0435\u043a\u0430\u0431\u0440\u044f\",     \"\\b\u043d\u0430\\b\", \"\\b\u0432\\b\", \"\\b\u0441\\b\", \"\\b\u043a\\b\", \"\\b\u0438\u0437-\u0437\u0430\\b\", \"\\b\u0438\u0437\\b\", \"\\b\u0437\u0430\\b\",  \"\\b\u043e\u0442\\b\", \"\\b\u043f\u0435\u0440\u0435\u0434\\b\", \"\\b\u0438\\b\",  \"\\b\u0438\u043b\u0438\\b\",  \"\\b\u0434\u0430\\b\",  \"\\b\u043d\u0435\u0442\\b\", \"\\b\u043a\u0430\u043a\\b\", \"\\b\u0442\u0430\u043a\\b\", \"\\b\u0432\u043e\u0442\\b\",      \"\\b\u0442\u043e\u043b\u044c\u043a\u043e\\b\", \"\\b\u043d\u0438\u0441\u043a\u043e\u043b\u044c\u043a\u043e\\b\", \"\\b\u0441\u043a\u043e\u043b\u044c\u043a\u043e\\b\", \"\\b\u0441\u0442\u043e\u043b\u044c\u043a\u043e\\b\", \"\\b\u0442\u043e\\b\", \"\\b\u0432\u043e\u0434\u0443\\b\"     );         foreach ($finresize_dataset as $value) {     $string_new = preg_replace(\"\/$value\/ui\", '', $string_new);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/ed0\/7d0\/192\/ed07d019216e0a58ecd9c177ea3187de.jpg\" alt=\"\" title=\"\" width=\"480\" height=\"299\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ed0\/7d0\/192\/ed07d019216e0a58ecd9c177ea3187de.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0411\u044b\u043b\u043e. \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u0432 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u0430\u0445 \u043c\u0435\u0436\u0434\u0443 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0437\u0432\u043e\u043d\u043a\u0430\u043c\u0438 \u0441\u043b\u0443\u0448\u0430\u043b\u0438 \u0430\u0443\u0434\u0438\u043e\u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a\u0430 \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0430\u0431\u0438\u0432\u0430\u043b\u0438 \u0437\u0430\u043a\u0430\u0437\u044b \u0432  CRM. <\/p>\n<p>\u0421\u0442\u0430\u043b\u043e. \u041f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0441\u043c\u044b\u0441\u043b\u043e\u0432 \u0437\u0430\u043a\u0430\u0437 \u0441 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a\u0430  \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 CRM \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0441\u043c\u044b\u0441\u043b\u044b \u0432\u044b\u0442\u0430\u0449\u0435\u043d\u044b, \u0442\u043e \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c &#8212; \u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u0434 \u0433\u043b\u0430\u0437\u0430\u043c\u0438 \u0443\u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442. <\/p>\n<p>\u0418\u0442\u043e\u0433. \u0421\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043a\u0430\u0437\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/408\/267\/22b\/40826722bc8adcf1b63e61cf24a3df6e.jpg\" alt=\"\" title=\"\" width=\"480\" height=\"197\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/408\/267\/22b\/40826722bc8adcf1b63e61cf24a3df6e.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/684914\/\"> https:\/\/habr.com\/ru\/post\/684914\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. <br \/>\u041a\u043b\u0438\u0435\u043d\u0442\u044b \u0437\u0432\u043e\u043d\u044f\u0442 \u0432 \u043d\u0435\u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043d\u0430 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a \u0438 \u0434\u0438\u043a\u0442\u0443\u044e\u0442 \u043d\u0430 \u0430\u0432\u0442\u043e\u043e\u0442\u0432\u0435\u0442\u0447\u0438\u043a \u0437\u0430\u043a\u0430\u0437.<\/p>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430\u0445 \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b\u044b \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0430\u0437 \u0432 CRM. \u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0430\u0443\u0434\u0438\u043e \u0432 \u0442\u0435\u043a\u0441\u0442 (\u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044f)<\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 Yandex Speech Kit.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 Yandex Speech Kit<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>\/\/ $token \u2013 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \/\/ $audioFileName \u2013 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u0430\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0435\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 ogg $file = fopen($audioFileName, 'rb');  $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, \"https:\/\/stt.api.cloud.yandex.net\/speech\/v1\/stt:recognize?lang=ru-RU&amp;format=oggopus\"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Api-Key ' . $token, 'Transfer-Encoding: chunked')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);  curl_setopt($ch, CURLOPT_INFILE, $file); $res = curl_exec($ch); curl_close($ch); $decodedResponse = json_decode($res, true); if (isset($decodedResponse[\"result\"])) { $text = urlencode($decodedResponse[\"result\"]); } else { echo \"Error code: \" . $decodedResponse[\"error_code\"] . \"\\r\\n\"; echo \"Error message: \" . $decodedResponse[\"error_message\"] . \"\\r\\n\"; }  fclose($file);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0435\u0441\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $text. <\/p>\n<h2>\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043c\u044b\u0441\u043b\u043e\u0432<\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. <br \/>\u0412 \u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u2013 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0449\u0435\u043c, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2013 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0442\u043e\u0432\u0430\u0440\u0430:<\/p>\n<pre><code>$name_dataset = array(\"\u043c\u044f\u0433\u043a\\D{2}\", \"\u043f\u0440\u0438\u0440\u043e\u0434\u043d\\D{2}\" ); $name_dataset_correct = array(\"\u0421\u0435\u0441\u0442\u0440\u0438\u0446\u0430 \u041c\u044f\u0433\u043a\u0430\u044f\", \"\u041f\u0440\u0438\u0440\u043e\u0434\u043d\u0430\u044f\" );<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c \u0438\u0449\u0435\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 $string:<\/p>\n<pre><code>$name = ''; foreach ($name_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";       if (preg_match($pattern, $string, $matches_quantity_1)) {         $name = $name_dataset_correct[$key];         }     }   if ($name == '') {$name = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}<\/code><\/pre>\n<p>\u0421 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>$quantity = ''; $quantity_dataset = array(\"\u0431\u0443\u0442\u044b\u043b\\D+ \u0432\u043e\u0434\u044b\", \"\u0431\u0443\u0442\u044b\u043b\u043e\u0447\\D{1,2}\", \"\u0431\u0443\u0442\u044b\u043b\\D{1,2}\", \"\u0448\u0442\u0443\\D+ \u0432\u043e\u0434\u044b\", \"\u0448\u0442\u0443\u0447\u0435\\D{0,2}\u043a\", \"\u0448\u0442\u0443\u043a\\D{0,1}\"); foreach ($quantity_dataset as $find) {     $pattern = \"\/\\d+ $find\/ui\";       if (preg_match($pattern, $string_new, $matches_quantity_1)) {                 preg_match(\"\/\\d+\/\", $matches_quantity_1[0], $matches_quantity_2);         $quantity = $matches_quantity_2[0];         }      }     if ($quantity == '') {$quantity = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}    $interval = \"\";  $interval_dataset = array(\"\u043a \u0443\u0442\u0440\u0443\", \"\u0443\u0442\u0440\u043e\u043c\", \"\\D{0,2} \u0443\u0442\u0440\u043e\", \"\u043a \u0432\u0435\u0447\u0435\u0440\u0443\", \"\u0432\u0435\u0447\u0435\u0440\u043e\u043c\", \"\\D{0,2} \u0432\u0435\u0447\u0435\u0440\", \"\u0434\u043e \u043e\u0431\u0435\u0434\u0430\", \"\u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430\",   \"\\D{1,2} 1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \u0434\u043d\u044f\", \"\\D{1,2} 1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1}\", \"1 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \\D{0,3}\", \"\\D{1,2} 2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \u0434\u043d\u044f\", \"\\D{1,2} 2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1}\",   \"2 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\\D{1} \\D{0,3}\", \"\u0441 15 \u0447\u0430\u0441\u043e\u0432\", \"\u0441 15 \u0434\u043e 18\", \"\u0441 18 \u0434\u043e 21\", \"\u0441 18 \u0434\u043e 22\", \"\u0441 18 \u0447\u0430\u0441\u043e\u0432\", \"\u0441 18\", \"\u043f\u043e\u0441\u043b\u0435 18 \u0447\u0430\u0441\u043e\u0432\", \"\u043f\u043e\u0441\u043b\u0435 18\", \"18 0 0\");        $interval_dataset_correct = array(\"\u0443\u0442\u0440\u043e\", \"\u0443\u0442\u0440\u043e\", \"\u0443\u0442\u0440\u043e\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0434\u043e \u043e\u0431\u0435\u0434\u0430\", \"\u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430\",   \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\", \"\u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u043d\u0430 \u0434\u043d\u044f\",   \"\u0441 15 \u0434\u043e 18-00\", \"\u0441 15 \u0434\u043e 18-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\", \"\u0441 18 \u0434\u043e 22-00\",   \"\u0441 18 \u0434\u043e 22-00\");  $interval = \"\"; foreach ($interval_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";     if (preg_match($pattern, $string_new, $matches_quantity_1)) {         $interval = $interval.\" \".$interval_dataset_correct[$key];         }      }   if ($interval == '') {$interval = \"(\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e)\";}<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430 ($name), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ($quantity) \u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 ($interval).<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u0434\u043e\u0432\u044b\u0435 \u0438\u043b\u0438 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0434\u043b\u044f \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u0438 \u043a\u043e\u0434\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>$stop_dataset = array(\"\u043e\u0442\u043c\u0435\u043d\\D{1,3}\", \"2 \u0437\u0430\u043a\u0430\u0437\u0430\", \"\u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\");  $stop_dataset_real = array(\"\u043e\u0442\u043c\u0435\u043d\u0430\", \"\u0414\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\", \"\u0414\u0432\u043e\u0439\u043d\u043e\u0439 \u0437\u0430\u043a\u0430\u0437\");  $stop = false; foreach ($stop_dataset as $key => $find) {     $pattern = \"\/$find\/ui\";       if (preg_match($pattern, $string, $matches_quantity_1)) {         $stop_world = $stop_dataset_real[$key];                }      else { }     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u043e\u0442\u043c\u0435\u043d\u0443 \u0437\u0430\u043a\u0430\u0437\u0430 \u0438\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;\u0442\u0440\u0435\u0432\u043e\u0436\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435&#187; \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c.<\/p>\n<h2>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430<\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f CRM \u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0432 CRM \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 dadata.<\/p>\n<pre><code>    $token = \"\u0412\u0410\u0428_API_\u041a\u041b\u042e\u0427\";     $secret = \"\u0412\u0410\u0428_\u0421\u0415\u041a\u0420\u0415\u0422\u041d\u042b\u0419_\u041a\u041b\u042e\u0427\";     $city=\"\u0417\u0410\u0414\u0410\u0415\u041c \u0413\u041e\u0420\u041e\u0414\";      $dadata = new Dadata($token, $secret);     $dadata->init();     $result = $dadata->clean(\"address\", $city.\" \".$string_new);     $address = $result[0][\"result\"];     $quality_cod = result[0][\"qc\"];     $dadata->close();<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0434 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0430\u0434\u0440\u0435\u0441. <br \/>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 $string_new, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c. <br \/>\u0410\u0434\u0440\u0435\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $address. <br \/>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u043e\u0434 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 ($quality_cod). <\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 class Dadata<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>class TooManyRequests extends Exception { }  class Dadata {     private $clean_url = \"https:\/\/cleaner.dadata.ru\/api\/v1\/clean\";     private $suggest_url = \"https:\/\/suggestions.dadata.ru\/suggestions\/api\/4_1\/rs\";     private $token;     private $secret;     private $handle;      public function __construct($token, $secret)     {         $this->token = $token;         $this->secret = $secret;     }      \/*      * Initialize connection.      *\/           public function init()     {         $this->handle = curl_init();         curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);         curl_setopt($this->handle, CURLOPT_HTTPHEADER, array(             \"Content-Type: application\/json\",             \"Accept: application\/json\",             \"Authorization: Token \" . $this->token,             \"X-Secret: \" . $this->secret,         ));         curl_setopt($this->handle, CURLOPT_POST, 1);     }      \/*      * Clean service.      * See for details:      *   - https:\/\/dadata.ru\/api\/clean\/address      *   - https:\/\/dadata.ru\/api\/clean\/phone      *   - https:\/\/dadata.ru\/api\/clean\/passport      *   - https:\/\/dadata.ru\/api\/clean\/name      *       * (!) This is a PAID service. Not included in free or other plans.      *\/           public function clean($type, $value)     {         $url = $this->clean_url . \"\/$type\";         $fields = array($value);         return $this->executeRequest($url, $fields);     }       \/*      * Close connection.      *\/           public function close()     {         curl_close($this->handle);     }      private function executeRequest($url, $fields)     {         curl_setopt($this->handle, CURLOPT_URL, $url);         if ($fields != null) {             curl_setopt($this->handle, CURLOPT_POST, 1);             curl_setopt($this->handle, CURLOPT_POSTFIELDS, json_encode($fields));         } else {             curl_setopt($this->handle, CURLOPT_POST, 0);         }         $result = $this->exec();         $result = json_decode($result, true);         return $result;     }      private function exec()     {         $result = curl_exec($this->handle);         $info = curl_getinfo($this->handle);         if ($info['http_code'] == 429) {             throw new TooManyRequests();         } elseif ($info['http_code'] != 200) {             throw new Exception('Request failed with http code ' . $info['http_code'] . ': ' .              $result);         }         return $result;     }<\/code><\/pre>\n<pre><code>public function __construct($token, $secret) {     $this->token = $token;     $this->secret = $secret; }  \/*  * Initialize connection.  *\/   public function init() {     $this->handle = curl_init();     curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);     curl_setopt($this->handle, CURLOPT_HTTPHEADER, array(         \"Content-Type: application\/json\",         \"Accept: application\/json\",         \"Authorization: Token \" . $this->token,         \"X-Secret: \" . $this->secret,     ));     curl_setopt($this->handle, CURLOPT_POST, 1); }  \/*  * Clean service.  * See for details:  *   - https:\/\/dadata.ru\/api\/clean\/address  *   - https:\/\/dadata.ru\/api\/clean\/phone  *   - https:\/\/dadata.ru\/api\/clean\/passport  *   - https:\/\/dadata.ru\/api\/clean\/name  *   * (!) This is a PAID service. Not included in free or other plans.  *\/   public function clean($type, $value) {     $url = $this->clean_url . \"\/$type\";     $fields = array($value);     return $this->executeRequest($url, $fields); }   \/*  * Close connection.  *\/   public function close() {     curl_close($this->handle); }  private function executeRequest($url, $fields) {     curl_setopt($this->handle, CURLOPT_URL, $url);     if ($fields != null) {         curl_setopt($this->handle, CURLOPT_POST, 1);         curl_setopt($this->handle, CURLOPT_POSTFIELDS, json_encode($fields));     } else {         curl_setopt($this->handle, CURLOPT_POST, 0);     }     $result = $this->exec();     $result = json_decode($result, true);     return $result; }  private function exec() {     $result = curl_exec($this->handle);     $info = curl_getinfo($this->handle);     if ($info['http_code'] == 429) {         throw new TooManyRequests();     } elseif ($info['http_code'] != 200) {         throw new Exception('Request failed with http code ' . $info['http_code'] . ': ' .          $result);     }     return $result; } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0435\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 CRM.<\/p>\n<h2>\u0423\u043b\u0443\u0447\u0448\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0434\u0440\u0435\u0441\u0430<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0440\u0430\u0437\u0443 \u0436\u0435, \u0442\u043e \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e, \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 \u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043d\u043e \u0438\u043b\u0438 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0430\u0434\u0440\u0435\u0441\u0443.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0438 \u043f\u0440\u043e\u0449\u0430\u043d\u0438\u044f:<\/p>\n<pre><code>$hallo_resize = array(\"\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\\D{0,2}\", \"\u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\\D{1,2}\", \"\u043f\u0440\u0438\u0432\u0435\u0442\", \"\u0434\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c\", \"\u0434\u043e\u0431\u0440\u043e\\D{1,2} \u0443\u0442\u0440\\D{1}\",<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-337619","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=337619"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337619\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}