{"id":297717,"date":"2020-01-26T21:00:15","date_gmt":"2020-01-26T21:00:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297717"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297717","title":{"rendered":"\u0411\u043e\u0442 \u0432 telegram, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0434\u043e\u043c\u0435\u043d\u043e\u043c"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485392\/\">\u041f\u0440\u0438\u0432\u0435\u0442 \u0436\u0438\u0442\u0435\u043b\u044f\u043c \u0425\u0430\u0431\u0440\u0430.<\/p>\n<p>  \u0412 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f PHP \u0438 \u0434\u043e\u043b\u0433\u0438\u0445 \u0440\u0430\u0437\u0434\u0443\u043c\u044c\u044f\u0445, \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043c\u044b\u0441\u043b\u044c, \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u0442\u0430 \u043d\u0430 PHP, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432.<\/p>\n<p>  \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0436\u0438\u0437\u043d\u0438 \u0434\u043e\u043c\u0435\u043d\u0430 (whois), \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 \u0434\u0430\u0442\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u043e\u043c\u0435\u043d \u0432 \u0411\u0414 (mysql), \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435\u043c \u0432 telegram.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/github.com\/Mazay98\/botDomain\" rel=\"nofollow\">\u043c\u043e\u0435\u043c<\/a> \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0433\u0438\u0442\u0435.<\/p>\n<p>  \u041c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/150267\/\">MVC<\/a> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430 <b>\u043c\u043e\u0439<\/b> \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c, \u0442\u0430\u043a \u043a\u0430\u043a view \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c mvc, \u043d\u043e \u0434\u0430 \u043b\u0430\u0434\u043d\u043e\u2026<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tw\/8v\/ve\/tw8vveeoxgfy1mcy7td3grjbjgq.png\"><\/p>\n<p>  <b>Contollerrs<\/b> \u2014 \u0421\u0432\u044f\u0437\u0443\u044e\u0449\u0435\u0435 \u0437\u0432\u0435\u043d\u043e, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442 model \u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <br \/>  <b>Models<\/b> \u2014 \u0424\u0430\u0439\u043b\u044b \u00ab\u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0421\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u00ab\u0437\u0430\u043f\u0438\u0445\u043d\u0443\u0442\u044c\u00bb \u0441\u044e\u0434\u0430 \u0432\u0435\u0441\u044c sql). <br \/>  <b>Core<\/b> \u2014 \u0424\u0430\u0439\u043b\u044b \u00ab\u044f\u0434\u0440\u0430\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  <b>Library<\/b> \u2014 \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u043c \u0438\u043c\u0435\u043d\u0438.<\/p>\n<h3>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  \u0424\u0430\u0439\u043b \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (routes.php) \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <i>core<\/i>.<br \/>  \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b 2 \u0430\u0434\u0440\u0435\u0441\u0430:<\/p>\n<p>  <b>\/bot<\/b> \u2014 \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0438\u0434\u0435\u0442 telegramm (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/core.telegram.org\/bots\/api#setwebhook\" rel=\"nofollow\">webhook<\/a> \u043d\u0430 \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u00aburi\/bot\u00bb).<br \/>  <b>\/check<\/b> \u2014 \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u043b\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Wget\" rel=\"nofollow\">wget<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e cron 1 \u0432 \u0434\u0435\u043d\u044c (\u0432 12 \u0447\u0430\u0441\u043e\u0432), \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h3>BotController<\/h3>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0435\u043b\u0430 <b>POST<\/b> \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. <\/p>\n<pre><code class=\"php\">json_decode(file_get_contents('php:\/\/input'), JSON_OBJECT_AS_ARRAY);<\/code><\/pre>\n<p>  <a href=\"https:\/\/www.php.net\/manual\/ru\/wrappers.php.php\" rel=\"nofollow\"><i>php:\/\/input<\/i><\/a> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043b\u043e POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<h3>CheckerController<\/h3>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043c\u0435\u043d\u044b \u0438 ssl \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043d\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0441 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c:<\/p>\n<ul>\n<li><i>\u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430 <\/i><\/li>\n<li><u>2 \u0434\u043d\u044f <\/u><\/li>\n<li><i>7 \u0434\u043d\u0435\u0439<\/i><\/li>\n<li><i>30 \u0434\u043d\u0435\u0439<\/i><\/li>\n<\/ul>\n<p>  \u0418 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0435\u0441\u043b\u0438 \u0434\u0430\u0442\u0430 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u0430 \u0438 ssl \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h3>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0438\u0448\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u043e\u0442\u0443 webhook telegram, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u043d\u0430\u0448 \u0441\u0430\u0439\u0442, \u0434\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 json \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jv\/t0\/ui\/jvt0uivydq_3yk_uw60gctyiklw.png\"><\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <b>message.<\/b><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <b>message[&#8216;chat&#8217;]<\/b>: <b>id<\/b> ,<b> first_name<\/b><br \/>  \u0433\u0434\u0435:<\/p>\n<p>  <b>id<\/b> \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0447\u0430\u0442\u0430 <br \/>  <b>first_name<\/b> \u2014 \u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  \u0410 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <b>message[&#8216;text&#8217;]<\/b>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 users, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c <\/p>\n<pre><code class=\"php\"> \/\/ \u0418\u0449\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f $sql= &quot;SELECT user_id FROM users WHERE chat_id=?&quot;; $stmt = $db-&gt;prepare($sql); $stmt-&gt;execute([$chat_id]); $rows = $stmt-&gt;fetch(PDO::FETCH_ASSOC); return (int)$rows['user_id']; <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"php\"> \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f $sql = 'INSERT INTO users (user_name, chat_id) VALUES (:user_name, :chat_id)'; $insert = $db-&gt;prepare($sql); $insert-&gt;execute([':user_name' =&gt; $name, ':chat_id' =&gt; $chat_id]); return true; <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0414\u043e\u043c\u0435\u043d\u043e\u0432 \u0438 SSL<\/h3>\n<p>  \u041f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <i>\/addDomain url<\/i> \u0431\u043e\u0442\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c url \u0434\u043e\u043c\u0435\u043d\u0430 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043c\u0435\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/regru\/php-whois\" rel=\"nofollow\">\u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/a>.<\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u043c\u0435\u043d<\/h4>\n<p>  \u041d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ca\/re\/sf\/caresfp0wregwz5rdtxbdbofhao.png\"><\/p>\n<p>  \u0418\u0437 \u043d\u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.php.net\/manual\/ru\/function.preg-match.php\" rel=\"nofollow\">\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/a>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u0442\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043c\u0435\u043d\u0430.<\/p>\n<pre><code class=\"php\"> preg_match('\/Registry\\sExpiry\\sDate:\\s(.*)\\\\r\/', $date, $matches); if (!$matches[1]){     preg_match('\/paid-till:\\s*(.*)\\\\n\/', $date, $matches); } $matches[1] = $this-&gt;formatDate($matches[1]); return $matches[1]; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SSL<\/h4>\n<p>  SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/OpenSSL\" rel=\"nofollow\">openssl<\/a> \u0434\u043b\u044f linux.<\/p>\n<pre><code class=\"php\"> $getDomainSSL = shell_exec(&quot;echo | openssl s_client -servername $url -connect $url:443 2&gt;\/dev\/null | openssl x509 -noout -dates&quot;); preg_match('~notAfter=(\\w+)\\s(\\d+)\\s.+\\s(\\d+)~', $getDomainSSL, $matches); $date =  $matches[2].$matches[1].$matches[3]; $date =  date(&quot;Y.m.d&quot;, strtotime($date)); $date = str_replace('.','-',$date); return $date; <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<pre><code class=\"bash\">echo | openssl s_client -servername google.com -connect google.com:443 2&gt;\/dev\/null | openssl x509 -noout -dates notBefore=Jan  7 15:47:12 2020 GMT notAfter=Mar 31 15:47:12 2020 GMT <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/p>\n<pre><code class=\"php\">preg_match('~notAfter=(\\w+)\\s(\\d+)\\s.+\\s(\\d+)~', $getDomainSSL, $matches);<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fq\/ua\/t6\/fquat6iqosjwx9bpw5uttjcnto0.png\"><\/p>\n<p>  \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"php\"> $sql = 'INSERT INTO domains (domain_name, date_start, date_end, date_end_ssl) VALUES (:domain_name, :date_start, :date_end, :date_end_ssl)'; $insert = $db-&gt;prepare($sql); $insert-&gt;execute([':domain_name' =&gt; $url, ':date_end' =&gt; $exp, ':date_end_ssl'  =&gt; $ssl_date]); <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043c\u0435\u043d \u0438 ssl \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e<\/h3>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 <a href=\"https:\/\/metanit.com\/sql\/tutorial\/1.3.php\" rel=\"nofollow\">\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <\/a> \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u00ab\u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0430\u0442\u044c\u00bb \u0434\u043e\u043c\u0435\u043d\u044b. <\/p>\n<pre><code class=\"php\"> $sql = 'INSERT INTO domain_users (user_id, domain_id) VALUES (:user_id, :domain_id)'; $insert = $db-&gt;prepare($sql); $insert-&gt;execute([':user_id' =&gt; $user_id, ':domain_id' =&gt; $domain_id]); <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u0430\u0442\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u0430<\/h3>\n<p>  \u041a\u043e\u0433\u0434\u0430 wget \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \/check, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0432\u0441\u0435\u0445 \u0434\u043e\u043c\u0435\u043d\u043e\u0432 \u0438 ssl \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443, \u0438 \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0447\u0430\u0442 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d.<\/p>\n<pre><code class=\"php\"> $db = $this-&gt;db;  $sql= &quot; \tSELECT user_name, chat_id, domain_name, date_end  \tFROM domain_users JOIN users USING (user_id) \tJOIN domains USING (domain_id) \tWHERE ( \t\tdomains.date_end = CURDATE() OR  \t\tdomains.date_end = CURDATE() + INTERVAL 2 DAY OR  \t\tdomains.date_end = CURDATE() + INTERVAL 7 DAY  OR  \t\tdomains.date_end = CURDATE() + INTERVAL 30 DAY \t) &quot;; $stmt = $db-&gt;prepare($sql); $stmt-&gt;execute(); $rows = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC); <\/code><\/pre>\n<p>  <\/p>\n<h3>CRON<\/h3>\n<p>  <a href=\"https:\/\/help.ubuntu.ru\/wiki\/cron\" rel=\"nofollow\">\u041a\u0440\u043e\u043d<\/a> \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 &#8216;\/check&#8217;, \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432 12 \u0447\u0430\u0441\u043e\u0432.<\/p>\n<pre><code class=\"bash\">crontab -e 0 12 * * * wget url\/check <\/code><\/pre>\n<p>  <\/p>\n<h3>TOR PROXY<\/h3>\n<p>  \u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 telegram.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043d\u0430 \u0442\u0435\u0440\u0440\u0438\u0442\u043e\u0440\u0438\u0438 \u043c\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u044b (\u0420\u043e\u0441\u0441\u0438\u044f), \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442 telegram, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0435\u0433\u043e api.<br \/>  \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438, \u043c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 <a href=\"https:\/\/wiki.archlinux.org\/index.php\/Tor_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)\" rel=\"nofollow\">tor proxy<\/a> (\u0435\u0449\u0435 \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430).<\/p>\n<p>  \u0415\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.<\/p>\n<pre><code class=\"bash\">sudo apt-get install tor<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u043a\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u043f\u043e\u0440\u0442\u0443 9050.<\/p>\n<pre><code class=\"php\"> curl_setopt($myCurl, CURLOPT_PROXYTYPE, 7); curl_setopt($myCurl, CURLOPT_PROXY, &quot;127.0.0.1:9050&quot;); <\/code><\/pre>\n<p>  \u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438!<\/p>\n<p>  \u042d\u0442\u0430 \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0433\u043e \ud83d\ude42<\/p>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u0440\u0438\u043c\u0443 \u043b\u044e\u0431\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 <a href=\"https:\/\/github.com\/Mazay98\/botDomain\" rel=\"nofollow\">\u043c\u043e\u0435\u043c<\/a> \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 github \ud83d\ude42<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/485392\/\"> https:\/\/habr.com\/ru\/post\/485392\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485392\/\">\u041f\u0440\u0438\u0432\u0435\u0442 \u0436\u0438\u0442\u0435\u043b\u044f\u043c \u0425\u0430\u0431\u0440\u0430.<\/p>\n<p>  \u0412 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f PHP \u0438 \u0434\u043e\u043b\u0433\u0438\u0445 \u0440\u0430\u0437\u0434\u0443\u043c\u044c\u044f\u0445, \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043c\u044b\u0441\u043b\u044c, \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u0442\u0430 \u043d\u0430 PHP, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432.<\/p>\n<p>  \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0436\u0438\u0437\u043d\u0438 \u0434\u043e\u043c\u0435\u043d\u0430 (whois), \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 \u0434\u0430\u0442\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u043e\u043c\u0435\u043d \u0432 \u0411\u0414 (mysql), \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435\u043c \u0432 telegram.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/github.com\/Mazay98\/botDomain\" rel=\"nofollow\">\u043c\u043e\u0435\u043c<\/a> \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0433\u0438\u0442\u0435.<\/p>\n<p>  \u041c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/150267\/\">MVC<\/a> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0447\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0430 <b>\u043c\u043e\u0439<\/b> \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c, \u0442\u0430\u043a \u043a\u0430\u043a view \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c mvc, \u043d\u043e \u0434\u0430 \u043b\u0430\u0434\u043d\u043e\u2026  <\/p>\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-297717","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297717","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=297717"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297717\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}