{"id":367603,"date":"2024-05-21T03:24:23","date_gmt":"2024-05-21T03:24:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=367603"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=367603","title":{"rendered":"<span>\u00ab\u0421\u043b\u043e\u0432\u043e \u0438\u0437 \u0442\u0440\u0451\u0445 \u0431\u0443\u043a\u0432\u00bb, \u0438\u043b\u0438 \u041f\u0438\u0448\u0435\u043c SMS-\u0430\u043d\u0430\u043b\u043e\u0433 Wordle \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MT\u0421 Exolve<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0438\u0433\u0440\u0435 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439 \u0441\u043b\u043e\u0432\u043e\u00bb \u0438 \u0435\u0451 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Wordle (\u00ab\u0412\u043e\u0440\u0434\u043b\u0438\u00bb). \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0441 \u043d\u0435\u0439 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u043f\u043e\u044f\u0441\u043d\u044e: \u043e\u043d\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u0443\u044e \u0434\u043e\u0431\u0440\u0443\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%B8%D1%81%D0%B5%D0%BB%D0%B8%D1%86%D0%B0_(%D0%B8%D0%B3%D1%80%D0%B0)\">\u00ab\u0412\u0438\u0441\u0435\u043b\u0438\u0446\u0443\u00bb<\/a> \u2014 \u0435\u0441\u0442\u044c \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0438 \u043d\u0430\u0434\u043e \u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0435\u0433\u043e \u0443\u0433\u0430\u0434\u0430\u0442\u044c. \u0422\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u043f\u043e \u0431\u0443\u043a\u0432\u0430\u043c, \u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0433\u0440\u0430 \u0441\u0442\u0430\u043b\u0430 \u0442\u0430\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0435\u0451 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u044b\u0435 \u0430\u043a\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0442\u0435\u043c\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u0430, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f. \u041a\u0430\u043a \u0431\u044b \u043d\u0435 \u0442\u0430\u043a! \u041c\u043d\u0435 \u0435\u0441\u0442\u044c \u0447\u0435\u043c \u0432\u0430\u0441 \u0443\u0434\u0438\u0432\u0438\u0442\u044c, \u0432\u0435\u0434\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0438\u0433\u0440\u044b, \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/07a\/600\/c3e\/07a600c3e8c85a4c424c05a0e8ce99a5.jpg\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/07a\/600\/c3e\/07a600c3e8c85a4c424c05a0e8ce99a5.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u043f\u0435\u0440\u0438\u043e\u0434\u0443 <a href=\"https:\/\/exolve.ru\/\">MT\u0421 Exolve<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0430 Wordly. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0430\u0434\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0434\u043b\u044f \u043a\u043e\u0433\u043e-\u0442\u043e \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438\u043b\u0438 \u0431\u043b\u0438\u0437\u043a\u0438\u0445. <\/p>\n<p>\u0418 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0438\u043b\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u0441\u0447\u0451\u0442\u0430, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. \u0412\u0435\u0434\u044c \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u043e\u0439\u0442\u0438 \u0434\u043e SMS, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 HTTP API \u0434\u043b\u044f \u0438\u0433\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u00ab\u0443\u0433\u0430\u0434\u0430\u0439\u043a\u0443\u00bb \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 SMS (<s>\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/s>) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, cURL \u0438\u043b\u0438 Postman.<\/p>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0446\u0435\u043f\u0442. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u043b\u044e\u0431\u043e\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0441 php \u0438 SQlite (\u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439)<\/p>\n<\/li>\n<li>\n<p>\u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 <a href=\"https:\/\/exolve.ru\/products\/sms-api\/?utm_source=habr&amp;utm_medium=refferal&amp;utm_campaign=sms_api_article&amp;utm_content=article_wordle&amp;utm_term=sms_api_exolve\">MT\u0421 Exolve<\/a> \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>PHP-\u0441\u043a\u0440\u0438\u043f\u0442 c API \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 SMS<\/p>\n<\/li>\n<\/ul>\n<h2>\u0427\u0442\u043e \u0437\u0430 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439\u043a\u0430\u00bb \u0442\u0430\u043a\u0430\u044f?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0430\u0436\u0438\u043e\u0442\u0430\u0436 \u0432\u043e\u043a\u0440\u0443\u0433 Wordle \u0438 \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0448\u0451\u043b \u043c\u0438\u043c\u043e \u0432\u0430\u0441, \u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0438\u0433\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u0442\u044c \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u2014 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0437 5 \u0431\u0443\u043a\u0432<\/p>\n<\/li>\n<li>\n<p>\u0441\u043b\u043e\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438\u0433\u0440\u043e\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0438\u0433\u0440\u043e\u043a \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<li>\n<p>\u0435\u043c\u0443 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u0443\u043a\u0432\u044b. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435:<br \/>\u25cb\u00a0\u0441\u0435\u0440\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u044b \u043d\u0435\u0442 \u0432 \u0441\u043b\u043e\u0432\u0435<br \/>\u25cb \u0436\u0451\u043b\u0442\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u0430 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0435, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435<br \/>\u25cb \u0437\u0435\u043b\u0451\u043d\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u0435\u0440\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0430\u043c \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u044b \u0431\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0432\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0438\u0433\u0440\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430 6 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043e\u0442\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c87\/cdd\/87e\/c87cdd87efefb5343c4c632baf057bc0.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 Wordly   \" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 Wordly   \" width=\"954\" height=\"691\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c87\/cdd\/87e\/c87cdd87efefb5343c4c632baf057bc0.png\"\/><\/p>\n<div><figcaption><em><sup>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 Wordly<\/sup><\/em>   <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c SMS-\u0438\u0433\u0440\u0443, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0438\u0433\u0440\u044b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u0435-\u043a\u0430\u043a\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0430: <\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0440\u0443\u0441\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 (\u044f <a href=\"https:\/\/harrix.dev\/blog\/2018\/russian-nouns\/\">\u0431\u0440\u0430\u043b \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0440\u0430\u0432\u043d\u043e \u0434\u043b\u0438\u043d\u0435 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \u0432 \u0441\u043b\u043e\u0432\u0435, \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u00ab\u041a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b\u00bb \u0441 \u0443\u0436\u0435 \u043d\u0430\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043d\u0435\u0442, \u0438\u0445 \u0432\u043f\u043e\u043b\u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f SMS-\u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043a\u0440\u0438\u043d \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u0433\u0440\u044b \u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430\u0434 \u00ab\u0456\u00bb \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b, \u043f\u0440\u0438\u0448\u043b\u0430 \u043f\u043e\u0440\u0430 \u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u043a\u043e\u0434. <\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c API<\/h2>\n<p>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440. \u042f \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0437\u0430 \u044d\u0442\u0430\u043b\u043e\u043d \u043a\u043e\u0434\u0430, \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u043c \u00ab\u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e\u00bb. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441 API \u0432\u0440\u044f\u0434 \u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0435\u043b\u0430.<\/p>\n<p>\u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d \u043d\u0430 <a href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bosonbeard\/Guess_the_word&amp;sa=D&amp;source=docs&amp;ust=1697619856538693&amp;usg=AOvVaw0QTencsf5esacc7L5zilD7\"><strong>GitHub<\/strong><\/a>.<\/p>\n<p>\u041d\u0443 \u0430 \u043f\u043e\u043a\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b API<\/h4>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 API \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 api.php. <\/p>\n<p>API \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 3 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>POST \u2014 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0438\u0433\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>PUT \u2014 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430<\/p>\n<\/li>\n<li>\n<p>GET \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435<\/p>\n<\/li>\n<\/ol>\n<h4>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite3 (db.sqlite).<\/p>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 games \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0438\u0433\u0440\u0435.<br \/>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 words \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0443\u0441\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414 \u2014 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b40\/1b2\/6b7\/b401b26b7f6a6b0893574ce5ee8bcf4f.png\" width=\"1548\" height=\"333\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b40\/1b2\/6b7\/b401b26b7f6a6b0893574ce5ee8bcf4f.png\"\/><\/figure>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 words \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u043e \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0447\u0442\u043e, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b games \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>id \u2014 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (ID \u0437\u0430\u043f\u0438\u0441\u0438)<\/p>\n<\/li>\n<li>\n<p>phone \u2014 \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u0430 \u0438\u0433\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>hidden_world \u2014 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<li>\n<p>current_world \u2014 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0443\u043a\u0432<\/p>\n<\/li>\n<li>\n<p>last_try_word \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0430 \u044d\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0443)<\/p>\n<\/li>\n<li>\n<p>in_word \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u043a\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0435, \u043d\u043e \u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435<\/p>\n<\/li>\n<li>\n<p>attempts \u2014 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u043e\u043a<\/p>\n<\/li>\n<\/ul>\n<h4>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/h4>\n<p>\u0415\u0449\u0451 \u043d\u0430\u0448 API \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a game-config.json. \u0412 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00ab\u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb \u0437\u0430\u0433\u0430\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0435\u0442 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445, \u0442\u043e \u0441\u043b\u043e\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u043e \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<pre><code class=\"php\">\"phones_words\": {    \"79121100234\": \"\u0434\u043e\u043c\",    \"79111977999\": \"\u0434\u0435\u0440\u0435\u0432\u043e\" },<\/code><\/pre>\n<p>\u0415\u0449\u0451 \u043a \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0444\u0430\u0439\u043b \u043b\u043e\u0433\u043e\u0432 api_log.txt. \u0412 \u043b\u043e\u0433\u0438 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0441\u043b\u043e\u0432\u043e (\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c), \u043c\u0435\u0442\u043e\u0434 API \u0438 \u043c\u0435\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440: <em>79111977999 \u043f\u0435\u043b\u0451\u043d\u043a\u0430 POST 2023-09-12T00:07:53+03:00<\/em><\/p>\n<h4>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0441\u043b\u043e\u0432\u043e \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/38a\/434\/9a9\/38a4349a9d421bc7d3a476de37d42571.png\" width=\"697\" height=\"1365\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/38a\/434\/9a9\/38a4349a9d421bc7d3a476de37d42571.png\"\/><\/figure>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u044f \u043e\u043f\u0443\u0449\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u0434\u0443.<\/p>\n<h4>\u041a\u043e\u0434 API<\/h4>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/github.com\/bosonbeard\/Guess_the_word\/blob\/main\/api.php\">api.php<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"php\">&lt;?php \/\/ Guess the word game API (c) BosonBeard 2023  \/\/ Headers header(\"Access-Control-Allow-Orgin: *\"); header(\"Access-Control-Allow-Methods: *\"); header(\"Content-Type: text\/plain\");  \/\/ Get parameters from query $method = $_SERVER['REQUEST_METHOD']; $phone = $_REQUEST[\"phone\"]; $user_word = mb_strtolower($_REQUEST[\"word\"]);  \/\/ write request in log $dt = date('c', time()); \/\/ get currtent time and date $fw = fopen(\"api_log.txt\", \"a+\"); fwrite($fw, $phone . \" \" . $user_word . \" \" . $method . \" \" . $dt . \"\\r\\n\"); fclose($fw);  \/\/connect to DB $db = new SQLite3('db.sqlite');  if ($phone) {  switch ($method) { \/\/ GET method - game status info case \"GET\":  \/\/ get last key command $sql = \"SELECT `hidden_word`,`current_word`,`in_word`,`attempts` FROM games WHERE `phone` = '$phone' \"; \/\/$sql = \"SELECT `hidden_word`,`current_word`,`in_word` FROM games WHERE `phone` = '$phone' ORDER BY `timestamp` DESC\"; $result = $db->querySingle($sql, true); $hidden_word = mb_strtolower($result['hidden_word']); $current_word = mb_strtolower($result['current_word']); $attempts = $result['attempts']; $have_attempts = mb_strlen($hidden_word) - $attempts;   if ($result['in_word']) { $in_word = $result['in_word'] . \" \u2014 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \\n\"; } \/\/ set API response  if ($result) {  if ($current_word != $hidden_word) { $response = \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $result[current_word] \\n\" . \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\" . $in_word; } else { $response = \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438! \\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } } else { $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\"; }  break; \/\/ POST method - start new game case \"POST\":  \/\/ get params from game-config.json $file = \"game-config.json\"; $json = json_decode(file_get_contents($file), true); $hidden_word = mb_strtolower($json['phones_words'][$phone]); if (!$hidden_word) { $numRows = $db->querySingle(\"SELECT COUNT(*) as count FROM words\"); \/\/ echo \"$numRows=\".$numRows; $hidden_word = mb_strtolower($db->querySingle(\"SELECT * FROM words LIMIT 1 OFFSET \" . (rand(0, $numRows)))); } $current_word = str_repeat(\"_\", mb_strlen($hidden_word)); $have_attempts = mb_strlen($hidden_word);   \/\/ add new not processed command in DB $sql = \"UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$current_word', `in_word`='', `attempts`=0, `last_try_word` ='' WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  $sql = \"INSERT INTO games (`phone`, `hidden_word`, `current_word`,`in_word`, `last_try_word`) VALUES('$phone','$hidden_word', '$current_word', '', '')\"; $result = $db->querySingle($sql);   \/\/ set API response $response = \"\u041d\u043e\u0432\u0430\u044f \u0438\u0433\u0440\u0430 \\n\" . \"\u0421\u043b\u043e\u0432\u043e: $current_word \\n\" . \"\u0411\u0443\u043a\u0432: \" . mb_strlen($current_word) . \" \\n\"; \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; break;  \/\/ PUT method - try to guess word case \"PUT\":  $sql = \"SELECT `hidden_word`,`current_word`, `last_try_word`, `in_word`, `attempts` FROM games WHERE `phone` = '$phone' \";  $result = $db->querySingle($sql, true); $current_word = mb_strtolower($result['current_word']); $hidden_word = mb_strtolower($result['hidden_word']); $last_try_word = mb_strtolower($result['last_try_word']);  $attempts = $result['attempts']; $have_attempts = mb_strlen($hidden_word) - ($attempts + 1);  \/\/ if DB is empty for this number, crate new game if (!$result) { $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\"; } else {  \/\/ check guessed word for noun. Reading dictionary from DB $is_noun = $db->querySingle(\"SELECT `word` FROM words WHERE `word` = '$user_word' \"); if (!$is_noun) { \/\/ if not noun try another word $response = \"\u0412\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432 \u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0430\u0434\u0435\u0436\u0435: \\n\" . \"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \\n\"; } \/\/ check to true guess else { \/\/ if guess - true if ($user_word == $hidden_word) { \/\/fixes a bug with the counter increasing when guessing if ($hidden_word != $current_word) { $attempts += 1; } $have_attempts = mb_strlen($hidden_word) - ($attempts);  $sql = \" UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$user_word', `in_word`='', `attempts`= $attempts WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  $response = \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438!\\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } \/\/ if the user sends the same word, again elseif ($user_word == $last_try_word) { $have_attempts += 1; $response = \"\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b \u0443\u0436\u0435 \u0432\u0432\u043e\u0434\u0438\u043b\u0438\\n\" . \"\u0441\u043b\u043e\u0432\u043e: $last_try_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } \/\/ user word not the same length to hidden word else { if (mb_strlen($hidden_word) != mb_strlen($user_word)) { $response = \"\u0414\u043b\u0438\u043d\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u043c! \\n\" . \"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443.\\n\"; \"\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441: $current_word \\n\"; } else { \/\/ if user don't have attempts any more if ($have_attempts === 0) { $response = \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $user_word \\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u041f\u043e\u043f\u044b\u0442\u043a\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c, \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443 \\n\"; } \/\/ if guess word is false else {  $check_result = check_correct_letters($hidden_word, $user_word, $current_word); $attempts += 1; $sql = \" UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$check_result->current_word', `in_word`='$check_result->in_word', `attempts`= $attempts, `last_try_word`= '$user_word' WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  if ($check_result->in_word) { $in_word = $check_result->in_word . \" \u2014 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \\n\"; }  $response = \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $check_result->current_word \\n\" . \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a:\" . ($have_attempts) . \" \\n\" .$in_word; } } } } } break; \/\/ any other HTTP method default: $response = '{\"error\":\"unknown method\"}'; break; } } \/\/ phone is empty else { $response = '{\"error\":\"\u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0442\u0435\u043b\u0435\u0444\u043e\u043d\"}'; }  \/\/return API response echo $response;   \/\/ function for getting correct letters in word, and get correct letters on wrong places in word function check_correct_letters($hidden_word, $user_word, $current_word) {  \/\/ get unicode array from string $hidden_word_arr = preg_split('\/\/u', $hidden_word, 0, PREG_SPLIT_NO_EMPTY); $user_word_arr = preg_split('\/\/u', $user_word, 0, PREG_SPLIT_NO_EMPTY); $current_word_arr = preg_split('\/\/u', $current_word, 0, PREG_SPLIT_NO_EMPTY); \/\/ true letters on right place in word $in_word_arr = array(); \/\/ true letter on wrong place in word   for ($i = 0; $i &lt; count($user_word_arr); $i++) {   for ($j = 0; $j &lt; count($hidden_word_arr); $j++) { if ($hidden_word_arr[$j] == $user_word_arr[$i]) { \/\/ get true letter on right place if ($j == $i) { if ($current_word_arr[$j] == \"_\") { $current_word_arr[$i] = $user_word_arr[$i]; } } \/\/ get true letter on wrong place in word else { array_push($in_word_arr, $user_word_arr[$i]); } } } }  $in_word_arr = array_unique($in_word_arr, SORT_REGULAR);  return (object) [ 'current_word' => implode($current_word_arr), 'in_word' => implode(\",\", $in_word_arr), ]; } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"php\">\/\/ Headers header(\"Access-Control-Allow-Orgin: *\"); header(\"Access-Control-Allow-Methods: *\"); header(\"Content-Type: text\/plain\");  \/\/ Get parameters from query $method = $_SERVER['REQUEST_METHOD']; $phone = $_REQUEST[\"phone\"]; $user_word = mb_strtolower($_REQUEST[\"word\"]);  \/\/ write request in log $dt = date('c', time()); \/\/ get currtent time and date $fw = fopen(\"api_log.txt\", \"a+\"); fwrite($fw, $phone . \" \" . $user_word . \" \" . $method . \" \" . $dt . \"\\r\\n\"); fclose($fw);  \/\/connect to DB $db = new SQLite3('db.sqlite');  if ($phone) {<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<br \/>\u0417\u0430\u0442\u0435\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c query-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434, \u044f \u0440\u0435\u0448\u0438\u043b \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 POST \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 body. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 query.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u043e\u0439 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a SQLite-\u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0443\u043a\u0430\u0437\u0430\u043d \u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430).<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0442\u0440\u0451\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 API.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043c\u0435\u0442\u043e\u0434\u0430 GET.<\/p>\n<pre><code class=\"php\">switch ($method) { \/\/ GET method - game status info case \"GET\":  \/\/ get last key command $sql = \"SELECT `hidden_word`,`current_word`,`in_word`,`attempts` FROM games WHERE `phone` = '$phone' \"; \/\/$sql = \"SELECT `hidden_word`,`current_word`,`in_word` FROM games WHERE `phone` = '$phone' ORDER BY `timestamp` DESC\"; $result = $db->querySingle($sql, true); $hidden_word = mb_strtolower($result['hidden_word']); $current_word = mb_strtolower($result['current_word']); $attempts = $result['attempts']; $have_attempts = mb_strlen($hidden_word) - $attempts;   if ($result['in_word']) { $in_word = $result['in_word'] . \" \u2014 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \\n\"; } \/\/ set API response  if ($result) {  if ($current_word != $hidden_word) { $response = \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $result[current_word] \\n\" . \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\" . $in_word; } else { $response = \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438! \\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } } else { $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\"; }  break;<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u0432\u044b\u0448\u0435, \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0445\u043e\u0434\u0435 \u0438\u0433\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c SELECT-\u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0411\u0414 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 in_word \u0431\u044b\u043b \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0442\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0411\u0414 (\u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443). \u0415\u0441\u043b\u0438 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0443\u0433\u0430\u0434\u0430\u043b \u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u0441\u043b\u043e\u0432\u043e \u0440\u0430\u043d\u0435\u0435. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 POST.<\/p>\n<pre><code class=\"php\">case \"POST\":  \/\/ get params from game-config.json $file = \"game-config.json\"; $json = json_decode(file_get_contents($file), true); $hidden_word = mb_strtolower($json['phones_words'][$phone]); if (!$hidden_word) { $numRows = $db->querySingle(\"SELECT COUNT(*) as count FROM words\"); \/\/ echo \"$numRows=\".$numRows; $hidden_word = mb_strtolower($db->querySingle(\"SELECT * FROM words LIMIT 1 OFFSET \" . (rand(0, $numRows)))); } $current_word = str_repeat(\"_\", mb_strlen($hidden_word)); $have_attempts = mb_strlen($hidden_word);   \/\/ add new not processed command in DB $sql = \"UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$current_word', `in_word`='', `attempts`=0, `last_try_word` ='' WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  $sql = \"INSERT INTO games (`phone`, `hidden_word`, `current_word`,`in_word`, `last_try_word`) VALUES('$phone','$hidden_word', '$current_word', '', '')\"; $result = $db->querySingle($sql);   \/\/ set API response $response = \"\u041d\u043e\u0432\u0430\u044f \u0438\u0433\u0440\u0430 \\n\" . \"\u0421\u043b\u043e\u0432\u043e: $current_word \\n\" . \"\u0411\u0443\u043a\u0432: \" . mb_strlen($current_word) . \" \\n\"; \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; break;<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0447\u0438\u0442\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 game-config.json. \u0414\u043b\u044f API \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043a \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0415\u0441\u043b\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043d\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438, \u0442\u043e \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b words \u0411\u0414.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u0411\u0414 \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u043d\u043e\u0432\u043e\u0439 \u0438\u0433\u0440\u0435. \u0423 \u043d\u0430\u0441 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0440\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f SQLite, \u044f \u043d\u0435 \u0441\u043c\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c UPSERT-\u043b\u043e\u0433\u0438\u043a\u0443, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 UPDATE, \u0430 \u0437\u0430\u0442\u0435\u043c INSERT.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0443\u043a\u0432 \u0432 \u043d\u0451\u043c \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u043e\u043f\u044b\u0442\u043e\u043a.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0441\u0442\u0430\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 PUT.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"php\">        case \"PUT\":              $sql = \"SELECT `hidden_word`,`current_word`, `last_try_word`, `in_word`, `attempts` FROM games WHERE `phone` = '$phone' \";              $result = $db->querySingle($sql, true);             $current_word = mb_strtolower($result['current_word']);             $hidden_word = mb_strtolower($result['hidden_word']);             $last_try_word = mb_strtolower($result['last_try_word']);              $attempts = $result['attempts'];             $have_attempts = mb_strlen($hidden_word) - ($attempts + 1);              \/\/ if DB is empty for this number, crate new game             if (!$result) {                 $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\";             } else {                  \/\/ check guessed word for noun. Reading dictionary from DB                 $is_noun = $db->querySingle(\"SELECT  `word`  FROM words WHERE `word` = '$user_word' \");                 if (!$is_noun) {                     \/\/ if not noun try another word                      $response =                         \"\u0412\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432 \u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0430\u0434\u0435\u0436\u0435: \\n\" .                         \"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \\n\";                 }                   \/\/ check to true guess                 else {                     \/\/ if guess - true                     if ($user_word == $hidden_word) {                                                  \/\/fixes a bug with the counter increasing when guessing                         if ($hidden_word != $current_word) {                             $attempts += 1;                         }                         $have_attempts = mb_strlen($hidden_word) - ($attempts);                          $sql = \" UPDATE  games                       SET `hidden_word`='$hidden_word', `current_word`='$user_word',                     `in_word`='', `attempts`= $attempts  WHERE `phone` = $phone\";                         $result = $db->querySingle($sql);                          $response =                             \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438!\\n\" .                             \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" .                             \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\";                     }                      \/\/ if the user sends the same word, again                     elseif ($user_word == $last_try_word) {                         $have_attempts += 1;                         $response =                             \"\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b \u0443\u0436\u0435 \u0432\u043e\u0434\u0438\u043b\u0438\\n\" .                             \"\u0441\u043b\u043e\u0432\u043e: $last_try_word \\n\" .                             \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\";                     }                      \/\/ user word not the same length to hidden word                     else {                         if (mb_strlen($hidden_word) != mb_strlen($user_word)) {                             $response =                                 \"\u0414\u043b\u0438\u043d\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u043c! \\n\" .                                 \"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443.\\n\";                             \"\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441: $current_word \\n\";                         }                                                   else {                             \/\/ if user don't have attempts any more                             if ($have_attempts === 0) {                                 $response =                                     \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $user_word \\n\" .                                     \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" .                                     \"\u041f\u043e\u043f\u044b\u0442\u043a\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c, \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443 \\n\";                             }                              \/\/ if guess word is false                             else {                                  $check_result = check_correct_letters($hidden_word, $user_word, $current_word);                                 $attempts += 1;                                 $sql = \" UPDATE  games                                     SET `hidden_word`='$hidden_word', `current_word`='$check_result->current_word',                                  `in_word`='$check_result->in_word', `attempts`= $attempts, `last_try_word`= '$user_word'                                   WHERE `phone` = $phone\";                                 $result = $db->querySingle($sql);                                  if ($check_result->in_word) {                                     $in_word = $check_result->in_word . \" \u2014 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \\n\";                                 }                                  $response =                                     \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $check_result->current_word  \\n\" .                                     \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a:\" . ($have_attempts) . \" \\n\"                                     .$in_word;                             }                         }                     }                 }             }             break;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u0411\u0414 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441.<br \/>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u043e\u043f\u044b\u0442\u043e\u043a.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0411\u0414. \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0443\u0433\u0430\u0434\u0430\u043b \u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u0441\u043b\u043e\u0432\u043e. \u0415\u0441\u043b\u0438 \u0443\u0433\u0430\u0434\u0430\u043b, \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0411\u0414, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434 GET \u0432\u0435\u0440\u043d\u0443\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0431\u0435\u0434\u0435. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $response \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u0431\u0435\u0434\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u0433\u0430\u0434\u0430\u043b, \u0438\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u043e \u0436\u0435 \u0441\u043b\u043e\u0432\u043e, \u0447\u0442\u043e \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437. \u0415\u0441\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b, \u0442\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0435. <\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c \u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f check_correct_letters (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0436\u0435), \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0430\u0437\u0443 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. <\/p>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u0441\u0435\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442, \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $response.<\/p>\n<pre><code class=\"php\">        default:             $response   = '{\"error\":\"unknown method\"}';             break;     } } \/\/ phone is empty else {     $response   = '{\"error\":\"\u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0442\u0435\u043b\u0435\u0444\u043e\u043d\"}'; }  echo $response;<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0443\u043a\u0432 \u0432 \u0441\u043b\u043e\u0432\u0435.<\/p>\n<pre><code class=\"php\">function check_correct_letters($hidden_word, $user_word, $current_word) {      \/\/ get unicode array from string     $hidden_word_arr = preg_split('\/\/u', $hidden_word, 0, PREG_SPLIT_NO_EMPTY);      $user_word_arr = preg_split('\/\/u', $user_word, 0, PREG_SPLIT_NO_EMPTY);      $current_word_arr =  preg_split('\/\/u', $current_word, 0, PREG_SPLIT_NO_EMPTY);  \/\/ true letters on right place in word     $in_word_arr = array();  \/\/ true letter on wrong place in word       for ($i = 0; $i &lt; count($user_word_arr); $i++) {           for ($j = 0; $j &lt; count($hidden_word_arr); $j++) {             if ($hidden_word_arr[$j] == $user_word_arr[$i]) {                 \/\/ get true letter on right place                 if ($j == $i) {                     if ($current_word_arr[$j] == \"_\") {                         $current_word_arr[$i] = $user_word_arr[$i];                     }                 }                  \/\/ get true letter on wrong place in word                 else {                     array_push($in_word_arr, $user_word_arr[$i]);                 }             }         }     }      $in_word_arr =  array_unique($in_word_arr, SORT_REGULAR);      return    (object) [         'current_word' => implode($current_word_arr),         'in_word' => implode(\",\", $in_word_arr),     ]; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0441\u043b\u043e\u0432\u043e \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043b\u043e\u0432\u043e \u0432 \u0431\u0430\u0437\u0435. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0443\u043a\u0432. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0443\u043a\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u044f\u0442 \u0432 \u0441\u043b\u043e\u0432\u0435 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u0430\u044f. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u043e\u0432\u043f\u0430\u043b\u0438, \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0441\u043e\u0432\u043f\u0430\u043b\u0438 \u043b\u0438 \u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0441\u043b\u043e\u0432\u0435. \u0415\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u043b\u0438, \u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u0443\u043a\u0432\u0430 \u0443\u0433\u0430\u0434\u0430\u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043b\u043e\u0432\u043e (current_word). \u0415\u0441\u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u043b\u0438, \u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u0443\u043a\u0432\u0430 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0435, \u043d\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0438\u0448\u0435\u043c \u0435\u0451 \u0432 in_word_arr.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u0451\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0441\u0431\u043e\u0438, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442. API \u0433\u043e\u0442\u043e\u0432\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Postman.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8df\/03b\/d8d\/8df03bd8dc8c76ab5d17f2f7ecd7d70d.png\" width=\"1021\" height=\"806\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8df\/03b\/d8d\/8df03bd8dc8c76ab5d17f2f7ecd7d70d.png\"\/><\/figure>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 SMS <\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u0433\u0440\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b <a href=\"https:\/\/exolve.ru\/products\/sms-api\/?utm_source=habr&amp;utm_medium=refferal&amp;utm_campaign=sms_api_article&amp;utm_content=article_wordle&amp;utm_term=sms_api_exolve\">\u041c\u0422\u0421 Exolve<\/a>. \u0412 <a href=\"https:\/\/habr.com\/ru\/companies\/ru_mts\/articles\/739078\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b<\/a>, \u043a\u0430\u043a \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u0431\u0430\u043b\u0430\u043d\u0441\u043e\u043c \u0432 300 \u0440\u0443\u0431\u043b\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0433 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0430 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 listener.php \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 SMS. \u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u00bb \u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 URL \u0434\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 listener.php, \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fdd\/28d\/af7\/fdd28daf73b153b689ad603b026f804e.png\" width=\"1088\" height=\"680\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fdd\/28d\/af7\/fdd28daf73b153b689ad603b026f804e.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u0435 \u0438\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 SMS \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 listener.php.<\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0431 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445. \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0441\u0442\u0430, \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b API \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b API \u0432 \u043e\u0442\u0432\u0435\u0442\u043d\u043e\u043c SMS.<\/p>\n<p>\u0412\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 4 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/204\/393\/5d5\/2043935d5be516ef96e0e5e26e154d5f.png\" width=\"832\" height=\"842\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/204\/393\/5d5\/2043935d5be516ef96e0e5e26e154d5f.png\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043a\u043e\u0434\u0443. \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/github.com\/bosonbeard\/Guess_the_word\/blob\/main\/listener.php\">listener.php<\/a> \u2014 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"php\">&lt;?php  \/\/ MTS Exolve SMS listener for guess the word game API  const PAGE_ENCODING = 'UTF-8';  \/\/ Heaers header(\"Access-Control-Allow-Orgin: *\"); header(\"Access-Control-Allow-Methods: *\"); header(\"Content-Type: application\/json\");  $data = json_decode(file_get_contents('php:\/\/input'), true);   \/\/ Get parameters from SMS \/\/$method = $_SERVER['REQUEST_METHOD']; $phone = $data[\"sender\"]; $receiver = $data[\"receiver\"]; $text = trim(mb_strtolower($data[\"text\"])); $direction = strtolower($data[\"direction\"]); $billing_status = strtolower($data[\"billing_status\"]); \/\/ listen olly incoming messages  \/\/ only incoming and billed SMS (prevent double send) if ($direction == strtolower(\"DIRECTION_INCOMING\") and $billing_status == strtolower(\"BILLING_STATUS_BILLED\") ) {   \/\/ get params from game-config.json $file = \"game-config.json\"; $json = json_decode(file_get_contents($file), true); $sms_api_key = $json['config']['sms_api_key']; $sms_api_url = $json['config']['sms_api_url']; $url = $json['config']['base_url'];  \/\/we get phone parameter for call api here   $dt = date('c', time()); \/\/ get currtent time and date  \/\/ write request in log $fw = fopen(\"listener_log.txt\", \"a+\"); fwrite($fw, $phone . \" \" . $text . \" \" . $dt . \"\\r\\n\"); fclose($fw);   if ($phone) {  \/\/ empty SMS or text = help - send hint if ($text == \"\" or $text == \"help\") { $response = \"\u0418\u0433\u0440\u0430 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439 \u0441\u043b\u043e\u0432\u043e\u00bb, \u043e\u0442\u043f\u0440\u0430\u0432\u044c\u0442\u0435: \\n\" . \"start - \u043d\u043e\u0432\u0430\u044f \u0438\u0433\u0440\u0430 \\n\" . \"info - \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0438\u0433\u0440\u044b \\n\" . \"help \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e - \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \\n\" . \"\u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u043b\u043e\u0432\u043e - \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \\n\"; $res = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ start new game (use POST method game API) elseif ($text == \"start\") {  $res = call_API($url, \"POST\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ send game status (GET method of game API) elseif ($text == \"info\") { $res = call_API($url, \"GET\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ send word for checking (PUT method of game API) else { $res = call_API($url, \"PUT\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); }   echo $response; } } else { echo \"error not incoming message\"; }  \/\/ call game api (api.php) function call_API($api_url, $method, $user_phone, $user_word)  {  \/\/ setup curl $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application\/json', ));  switch ($method) { case \"PUT\": curl_setopt($curl, CURLOPT_PUT, 1); $url = $api_url . \"?phone=\" . $user_phone . \"&amp;word=\" . $user_word; curl_setopt($curl, CURLOPT_URL, $url); break; case \"POST\": curl_setopt($curl, CURLOPT_POST, 1); $url = $api_url . \"?phone=\" . $user_phone; curl_setopt($curl, CURLOPT_URL, $url); break; case \"GET\": $url = $api_url . \"?phone=\" . $user_phone; curl_setopt($curl, CURLOPT_URL, $url); break;  default: $response = '{\"error\":\"unknown method\"}';  break; }  $result = curl_exec($curl);  if (!$response) {  $response = $result; }  curl_close($curl);  return $response; }  \/\/ call MTS Exolve SMS send API function send_SMS($phone, $receiver, $text, $sms_api_key, $sms_api_url) { \/\/ create POST body $data = array(\"destination\" => $phone, \"number\" => $receiver, \"text\" => $text); $data_json = json_encode($data);  \/\/ setup curl $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application\/json', 'Authorization: Bearer ' . $sms_api_key )); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, $sms_api_url); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_json); $result = curl_exec($curl); sleep(1); curl_close($curl); return $result;  }   \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0431\u043b\u043e\u043a\u0438 \u043a\u043e\u0434\u0430. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0443\u0442 \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 API, \u044f \u043e\u043f\u0443\u0449\u0443 \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439.  $data = json_decode(file_get_contents('php:\/\/input'), true);   \/\/ Get parameters from SMS \/\/$method = $_SERVER['REQUEST_METHOD']; $phone = $data[\"sender\"]; $receiver = $data[\"receiver\"]; $text = trim(mb_strtolower($data[\"text\"])); $direction = strtolower($data[\"direction\"]); $billing_status = strtolower($data[\"billing_status\"]); \/\/ listen olly incoming messages  \/\/ only incoming and billed SMS (prevent double send) if ($direction == strtolower(\"DIRECTION_INCOMING\") and $billing_status == strtolower(\"BILLING_STATUS_BILLED\") ) {<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043b\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u041c\u0422\u0421 Exolve. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 <a href=\"https:\/\/docs.exolve.ru\/docs\/ru\/api-reference\/sms-api\/sms-events\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a (\u043e\u0431\u044a\u0435\u043a\u0442 config).<\/p>\n<pre><code class=\"php\">$file = \"game-config.json\"; $json = json_decode(file_get_contents($file), true); $sms_api_key = $json['config']['sms_api_key']; $sms_api_url = $json['config']['sms_api_url']; $url = $json['config']['base_url'];<\/code><\/pre>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:<\/p>\n<pre><code class=\"php\">\"config\": { \"base_url\": \"\u0432\u0430\u0448 \u0434\u043e\u043c\u0435\u043d, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u0435\u0436\u0438\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\/guess_word\/api.php\", \"sms_api_key\":\"Token \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043c. \u0432 \u041b\u041a MT\u0421 Exolve\", \"sms_api_url\":\"https:\/\/api.exolve.ru\/messaging\/v1\/SendSMS \u2013 \u0430\u0434\u0440\u0435\u0441 \u043c\u0435\u0442\u043e\u0434\u0430 Exolve API\" }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u043c \u0432 \u043e\u0442\u0432\u0435\u0442\u043d\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043f\u043e \u0438\u0433\u0440\u0435 (help \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b api.php \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e SMS \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">if ($text == \"\" or $text == \"help\") { $response = \"\u0418\u0433\u0440\u0430 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439 \u0441\u043b\u043e\u0432\u043e\u00bb, \u043e\u0442\u043f\u0440\u0430\u0432\u044c\u0442\u0435: \\n\" . \"start - \u043d\u043e\u0432\u0430\u044f \u0438\u0433\u0440\u0430 \\n\" . \"info - \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0438\u0433\u0440\u044b \\n\" . \"help \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e - \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \\n\" . \"\u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u043b\u043e\u0432\u043e - \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \\n\"; $res = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ start new game (use POST method game API) elseif ($text == \"start\") {  $res = call_API($url, \"POST\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ send game status (GET method of game API) elseif ($text == \"info\") { $res = call_API($url, \"GET\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); } \/\/ send word for checking (PUT method of game API) else { $res = call_API($url, \"PUT\", $phone, $text); $response = $res; \/\/ get text message from game api $res2 = send_SMS($phone, $receiver, $response, $sms_api_key, $sms_api_url); }   echo $response;<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044e call_API \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u2014 \u0442\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432 API \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cURL. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e send_SMS.<\/p>\n<pre><code class=\"php\">function send_SMS($phone, $receiver, $text, $sms_api_key, $sms_api_url) { \/\/ create POST body $data = array(\"destination\" => $phone, \"number\" => $receiver, \"text\" => $text); $data_json = json_encode($data);  \/\/ setup curl $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application\/json', 'Authorization: Bearer ' . $sms_api_key )); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_URL, $sms_api_url); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_json); $result = curl_exec($curl); sleep(1); curl_close($curl); return $result;  }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u041c\u0422\u0421 Exolve. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0435: \u043a\u043e\u043c\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/docs.exolve.ru\/docs\/ru\/api-reference\/sms-api\/sending-sms\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a API \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<h2>\u0411\u0435\u0437\u0443\u0434\u0435\u0440\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c\u0441\u044f<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e, \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e \u2014 \u0438\u0433\u0440\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445, \u0442\u043e \u0438\u0433\u0440\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0432. \u041d\u043e \u0442\u0430\u043a \u0434\u0430\u0436\u0435 \u043b\u0443\u0447\u0448\u0435. \u041a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b, \u043f\u043b\u043e\u0434\u044b \u043d\u0430\u0448\u0438\u0445 \u0442\u0440\u0443\u0434\u043e\u0432 \u2014 \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u043d\u0438\u0436\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/951\/dab\/60d\/951dab60d23462c699d70d461c6a4eac.png\" width=\"914\" height=\"1017\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/951\/dab\/60d\/951dab60d23462c699d70d461c6a4eac.png\"\/><\/figure>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u043e\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u043b\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0430\u0440\u043e\u043a-\u0441\u044e\u0440\u043f\u0440\u0438\u0437 \u043a\u043e\u043c\u0443-\u0442\u043e \u0432 \u0432\u0438\u0434\u0435 SMS-\u0438\u0433\u0440\u044b \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0441\u0432\u043e\u0438\u043c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0432 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u044b\u0437\u0432\u0430\u043b\u0430 \u0443 \u0432\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/792118\/\"> https:\/\/habr.com\/ru\/articles\/792118\/<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0438\u0433\u0440\u0435 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439 \u0441\u043b\u043e\u0432\u043e\u00bb \u0438 \u0435\u0451 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Wordle (\u00ab\u0412\u043e\u0440\u0434\u043b\u0438\u00bb). \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0441 \u043d\u0435\u0439 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u043f\u043e\u044f\u0441\u043d\u044e: \u043e\u043d\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u0443\u044e \u0434\u043e\u0431\u0440\u0443\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%B8%D1%81%D0%B5%D0%BB%D0%B8%D1%86%D0%B0_(%D0%B8%D0%B3%D1%80%D0%B0)\">\u00ab\u0412\u0438\u0441\u0435\u043b\u0438\u0446\u0443\u00bb<\/a> \u2014 \u0435\u0441\u0442\u044c \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0438 \u043d\u0430\u0434\u043e \u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0435\u0433\u043e \u0443\u0433\u0430\u0434\u0430\u0442\u044c. \u0422\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u043f\u043e \u0431\u0443\u043a\u0432\u0430\u043c, \u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0433\u0440\u0430 \u0441\u0442\u0430\u043b\u0430 \u0442\u0430\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0435\u0451 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0442\u0438\u043d\u0433\u043e\u0432\u044b\u0435 \u0430\u043a\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0442\u0435\u043c\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u0430, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f. \u041a\u0430\u043a \u0431\u044b \u043d\u0435 \u0442\u0430\u043a! \u041c\u043d\u0435 \u0435\u0441\u0442\u044c \u0447\u0435\u043c \u0432\u0430\u0441 \u0443\u0434\u0438\u0432\u0438\u0442\u044c, \u0432\u0435\u0434\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0438\u0433\u0440\u044b, \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 SMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u043f\u0435\u0440\u0438\u043e\u0434\u0443 <a href=\"https:\/\/exolve.ru\/\">MT\u0421 Exolve<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0430 Wordly. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0430\u0434\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0434\u043b\u044f \u043a\u043e\u0433\u043e-\u0442\u043e \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438\u043b\u0438 \u0431\u043b\u0438\u0437\u043a\u0438\u0445. <\/p>\n<p>\u0418 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0438\u043b\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u0441\u0447\u0451\u0442\u0430, \u0441\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. \u0412\u0435\u0434\u044c \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u043e\u0439\u0442\u0438 \u0434\u043e SMS, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 HTTP API \u0434\u043b\u044f \u0438\u0433\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u00ab\u0443\u0433\u0430\u0434\u0430\u0439\u043a\u0443\u00bb \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 SMS (<s>\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/s>) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, cURL \u0438\u043b\u0438 Postman.<\/p>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0446\u0435\u043f\u0442. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u043b\u044e\u0431\u043e\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0441 php \u0438 SQlite (\u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439)<\/p>\n<\/li>\n<li>\n<p>\u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 <a href=\"https:\/\/exolve.ru\/products\/sms-api\/?utm_source=habr&amp;utm_medium=refferal&amp;utm_campaign=sms_api_article&amp;utm_content=article_wordle&amp;utm_term=sms_api_exolve\">MT\u0421 Exolve<\/a> \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>PHP-\u0441\u043a\u0440\u0438\u043f\u0442 c API \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 SMS<\/p>\n<\/li>\n<\/ul>\n<h2>\u0427\u0442\u043e \u0437\u0430 \u00ab\u0423\u0433\u0430\u0434\u0430\u0439\u043a\u0430\u00bb \u0442\u0430\u043a\u0430\u044f?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0430\u0436\u0438\u043e\u0442\u0430\u0436 \u0432\u043e\u043a\u0440\u0443\u0433 Wordle \u0438 \u0435\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432 \u043f\u0440\u043e\u0448\u0451\u043b \u043c\u0438\u043c\u043e \u0432\u0430\u0441, \u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0438\u0433\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u0442\u044c \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u2014 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0437 5 \u0431\u0443\u043a\u0432<\/p>\n<\/li>\n<li>\n<p>\u0441\u043b\u043e\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438\u0433\u0440\u043e\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0438\u0433\u0440\u043e\u043a \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<li>\n<p>\u0435\u043c\u0443 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u0443\u043a\u0432\u044b. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435:<br \/>\u25cb\u00a0\u0441\u0435\u0440\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u044b \u043d\u0435\u0442 \u0432 \u0441\u043b\u043e\u0432\u0435<br \/>\u25cb \u0436\u0451\u043b\u0442\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u0430 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0435, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435<br \/>\u25cb \u0437\u0435\u043b\u0451\u043d\u044b\u0439 \u2014 \u0431\u0443\u043a\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u0435\u0440\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0430\u043c \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u044b \u0431\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0432\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p>\u0438\u0433\u0440\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430 6 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043e\u0442\u0433\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\">\n<div><figcaption><em><sup>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 Wordly<\/sup><\/em>   <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c SMS-\u0438\u0433\u0440\u0443, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0438\u0433\u0440\u044b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u0435-\u043a\u0430\u043a\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0430: <\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0440\u0443\u0441\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 (\u044f <a href=\"https:\/\/harrix.dev\/blog\/2018\/russian-nouns\/\">\u0431\u0440\u0430\u043b \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0440\u0430\u0432\u043d\u043e \u0434\u043b\u0438\u043d\u0435 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \u0432 \u0441\u043b\u043e\u0432\u0435, \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u00ab\u041a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b\u00bb \u0441 \u0443\u0436\u0435 \u043d\u0430\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043d\u0435\u0442, \u0438\u0445 \u0432\u043f\u043e\u043b\u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f SMS-\u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043a\u0440\u0438\u043d \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u0433\u0440\u044b \u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430\u0434 \u00ab\u0456\u00bb \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b, \u043f\u0440\u0438\u0448\u043b\u0430 \u043f\u043e\u0440\u0430 \u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u043a\u043e\u0434. <\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c API<\/h2>\n<p>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440. \u042f \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0437\u0430 \u044d\u0442\u0430\u043b\u043e\u043d \u043a\u043e\u0434\u0430, \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u043c \u00ab\u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e\u00bb. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441 API \u0432\u0440\u044f\u0434 \u043b\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0443 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0435\u043b\u0430.<\/p>\n<p>\u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d \u043d\u0430 <a href=\"https:\/\/www.google.com\/url?q=https:\/\/github.com\/bosonbeard\/Guess_the_word&amp;sa=D&amp;source=docs&amp;ust=1697619856538693&amp;usg=AOvVaw0QTencsf5esacc7L5zilD7\"><strong>GitHub<\/strong><\/a>.<\/p>\n<p>\u041d\u0443 \u0430 \u043f\u043e\u043a\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b API<\/h4>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 API \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 api.php. <\/p>\n<p>API \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 3 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>POST \u2014 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0438\u0433\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>PUT \u2014 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430<\/p>\n<\/li>\n<li>\n<p>GET \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0435<\/p>\n<\/li>\n<\/ol>\n<h4>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite3 (db.sqlite).<\/p>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 games \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0438\u0433\u0440\u0435.<br \/>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 words \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0443\u0441\u0441\u043a\u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414 \u2014 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 words \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u043e \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0447\u0442\u043e, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b games \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>id \u2014 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (ID \u0437\u0430\u043f\u0438\u0441\u0438)<\/p>\n<\/li>\n<li>\n<p>phone \u2014 \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u0430 \u0438\u0433\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>hidden_world \u2014 \u0437\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/p>\n<\/li>\n<li>\n<p>current_world \u2014 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0443\u043a\u0432<\/p>\n<\/li>\n<li>\n<p>last_try_word \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0430 \u044d\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0443)<\/p>\n<\/li>\n<li>\n<p>in_word \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u043a\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0435, \u043d\u043e \u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435<\/p>\n<\/li>\n<li>\n<p>attempts \u2014 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u043e\u043a<\/p>\n<\/li>\n<\/ul>\n<h4>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/h4>\n<p>\u0415\u0449\u0451 \u043d\u0430\u0448 API \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a game-config.json. \u0412 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00ab\u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb \u0437\u0430\u0433\u0430\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0435\u0442 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445, \u0442\u043e \u0441\u043b\u043e\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u043e \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<pre><code class=\"php\">\"phones_words\": {    \"79121100234\": \"\u0434\u043e\u043c\",    \"79111977999\": \"\u0434\u0435\u0440\u0435\u0432\u043e\" },<\/code><\/pre>\n<p>\u0415\u0449\u0451 \u043a \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0444\u0430\u0439\u043b \u043b\u043e\u0433\u043e\u0432 api_log.txt. \u0412 \u043b\u043e\u0433\u0438 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0441\u043b\u043e\u0432\u043e (\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c), \u043c\u0435\u0442\u043e\u0434 API \u0438 \u043c\u0435\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440: <em>79111977999 \u043f\u0435\u043b\u0451\u043d\u043a\u0430 POST 2023-09-12T00:07:53+03:00<\/em><\/p>\n<h4>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0441\u043b\u043e\u0432\u043e \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u044f \u043e\u043f\u0443\u0449\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u0434\u0443.<\/p>\n<h4>\u041a\u043e\u0434 API<\/h4>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/github.com\/bosonbeard\/Guess_the_word\/blob\/main\/api.php\">api.php<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"php\">&lt;?php \/\/ Guess the word game API (c) BosonBeard 2023  \/\/ Headers header(\"Access-Control-Allow-Orgin: *\"); header(\"Access-Control-Allow-Methods: *\"); header(\"Content-Type: text\/plain\");  \/\/ Get parameters from query $method = $_SERVER['REQUEST_METHOD']; $phone = $_REQUEST[\"phone\"]; $user_word = mb_strtolower($_REQUEST[\"word\"]);  \/\/ write request in log $dt = date('c', time()); \/\/ get currtent time and date $fw = fopen(\"api_log.txt\", \"a+\"); fwrite($fw, $phone . \" \" . $user_word . \" \" . $method . \" \" . $dt . \"\\r\\n\"); fclose($fw);  \/\/connect to DB $db = new SQLite3('db.sqlite');  if ($phone) {  switch ($method) { \/\/ GET method - game status info case \"GET\":  \/\/ get last key command $sql = \"SELECT `hidden_word`,`current_word`,`in_word`,`attempts` FROM games WHERE `phone` = '$phone' \"; \/\/$sql = \"SELECT `hidden_word`,`current_word`,`in_word` FROM games WHERE `phone` = '$phone' ORDER BY `timestamp` DESC\"; $result = $db->querySingle($sql, true); $hidden_word = mb_strtolower($result['hidden_word']); $current_word = mb_strtolower($result['current_word']); $attempts = $result['attempts']; $have_attempts = mb_strlen($hidden_word) - $attempts;   if ($result['in_word']) { $in_word = $result['in_word'] . \" \u2014 \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435 \\n\"; } \/\/ set API response  if ($result) {  if ($current_word != $hidden_word) { $response = \"\u0412\u0430\u0448\u0435 \u0441\u043b\u043e\u0432\u043e: $result[current_word] \\n\" . \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\" . $in_word; } else { $response = \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438! \\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } } else { $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\"; }  break; \/\/ POST method - start new game case \"POST\":  \/\/ get params from game-config.json $file = \"game-config.json\"; $json = json_decode(file_get_contents($file), true); $hidden_word = mb_strtolower($json['phones_words'][$phone]); if (!$hidden_word) { $numRows = $db->querySingle(\"SELECT COUNT(*) as count FROM words\"); \/\/ echo \"$numRows=\".$numRows; $hidden_word = mb_strtolower($db->querySingle(\"SELECT * FROM words LIMIT 1 OFFSET \" . (rand(0, $numRows)))); } $current_word = str_repeat(\"_\", mb_strlen($hidden_word)); $have_attempts = mb_strlen($hidden_word);   \/\/ add new not processed command in DB $sql = \"UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$current_word', `in_word`='', `attempts`=0, `last_try_word` ='' WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  $sql = \"INSERT INTO games (`phone`, `hidden_word`, `current_word`,`in_word`, `last_try_word`) VALUES('$phone','$hidden_word', '$current_word', '', '')\"; $result = $db->querySingle($sql);   \/\/ set API response $response = \"\u041d\u043e\u0432\u0430\u044f \u0438\u0433\u0440\u0430 \\n\" . \"\u0421\u043b\u043e\u0432\u043e: $current_word \\n\" . \"\u0411\u0443\u043a\u0432: \" . mb_strlen($current_word) . \" \\n\"; \"\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; break;  \/\/ PUT method - try to guess word case \"PUT\":  $sql = \"SELECT `hidden_word`,`current_word`, `last_try_word`, `in_word`, `attempts` FROM games WHERE `phone` = '$phone' \";  $result = $db->querySingle($sql, true); $current_word = mb_strtolower($result['current_word']); $hidden_word = mb_strtolower($result['hidden_word']); $last_try_word = mb_strtolower($result['last_try_word']);  $attempts = $result['attempts']; $have_attempts = mb_strlen($hidden_word) - ($attempts + 1);  \/\/ if DB is empty for this number, crate new game if (!$result) { $response = \"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443\"; } else {  \/\/ check guessed word for noun. Reading dictionary from DB $is_noun = $db->querySingle(\"SELECT `word` FROM words WHERE `word` = '$user_word' \"); if (!$is_noun) { \/\/ if not noun try another word $response = \"\u0412\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432 \u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0430\u0434\u0435\u0436\u0435: \\n\" . \"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \\n\"; } \/\/ check to true guess else { \/\/ if guess - true if ($user_word == $hidden_word) { \/\/fixes a bug with the counter increasing when guessing if ($hidden_word != $current_word) { $attempts += 1; } $have_attempts = mb_strlen($hidden_word) - ($attempts);  $sql = \" UPDATE games SET `hidden_word`='$hidden_word', `current_word`='$user_word', `in_word`='', `attempts`= $attempts WHERE `phone` = $phone\"; $result = $db->querySingle($sql);  $response = \"\u0412\u044b \u0443\u0433\u0430\u0434\u0430\u043b\u0438!\\n\" . \"\u0417\u0430\u0433\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: $hidden_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } \/\/ if the user sends the same word, again elseif ($user_word == $last_try_word) { $have_attempts += 1; $response = \"\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b \u0443\u0436\u0435 \u0432\u0432\u043e\u0434\u0438\u043b\u0438\\n\" . \"\u0441\u043b\u043e\u0432\u043e: $last_try_word \\n\" . \"\u0415\u0449\u0451 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u044b\u0442\u043e\u043a: $have_attempts \\n\"; } \/\/ user word not the same length to hidden word else { if<\/code><\/pre>\n<\/div>\n<\/details>\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-367603","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367603","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=367603"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367603\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}