{"id":331097,"date":"2022-03-26T15:00:23","date_gmt":"2022-03-26T15:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331097"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331097","title":{"rendered":"<span>API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435: \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0441\u0430\u0439\u0442\u0430 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435. \u0412\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435. \u0412\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 PHP.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0430\u0439\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 API.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013\u00a0<a href=\"https:\/\/vk.com\/apps?act=manage\" rel=\"noopener noreferrer nofollow\">https:\/\/vk.com\/apps?act=manage<\/a><\/p>\n<p>\u0414\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0421\u0430\u0439\u0442 -> API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c\u00a0<strong>Standalone-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ab\/05c\/557\/9ab05c557c2b6b0e2f3a987ff87bf5a5.png\" width=\"1024\" height=\"490\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ab\/05c\/557\/9ab05c557c2b6b0e2f3a987ff87bf5a5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0439\u0442\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0418 \u0432\u044b\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u0430\u043d\u043d\u044b\u0435: \u201c<strong>id \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong>\u201c, \u201c<strong>\u0417\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447<\/strong>\u201c, \u201c<strong>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/strong>\u201c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c Open API \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u043e\u043b\u044f\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043c\u0435\u043d \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u0430\u0440\u0441\u0435\u0440.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u0430\u0448\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c1e\/7c2\/bfe\/c1e7c2bfeae4b19b76fba11f99dd100e.png\" width=\"723\" height=\"605\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c1e\/7c2\/bfe\/c1e7c2bfeae4b19b76fba11f99dd100e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>1. \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c URL \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.  <\/p>\n<pre><code>https:\/\/oauth.vk.com\/authorize?client_id=ID_\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u042f&amp;display=page &amp;redirect_uri=https:\/\/api.vk.com\/blank.html&amp;scope=offline,wall,photos &amp;response_type=code<\/code><\/pre>\n<p>2. \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u00a0<code>access_token<\/code>. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u044b\u0439 URL, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0432\u00a0<code>client_id<\/code>,\u00a0<code>client_secret<\/code>\u00a0\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u00a0<code>access_token<\/code>.<\/p>\n<pre><code>https:\/\/oauth.vk.com\/access_token?client_id=ID_\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u042f &amp;client_secret=\u0417\u0410\u0429\u0418\u0429\u0415\u041d\u041d\u042b\u0419_\u041a\u041b\u042e\u0427&amp;redirect_uri=https:\/\/api.vk.com\/blank.html &amp;code=\u0421\u0415\u041a\u0420\u0415\u0422\u041d\u042b\u0419_\u041a\u041e\u0414<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/h4>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 PHP \u043a\u043b\u0430\u0441\u0441 \u0438 \u043d\u0430\u0437\u043e\u0432\u0443 \u0435\u0433\u043e\u00a0<strong>BotsTime_AutopostingVk<\/strong><\/p>\n<pre><code>class BotsTime_AutopostingVk {         \/* \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 *\/ public $token = \"97a1b7bff17bd61309c109ac7e1231dasdfsdfe2dac84ac0254961fe8a5121e553b95eca754e8e889f7dbb4fe\";         \/* id \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f *\/ public $owner_id = -209887634; public $versionVk = \"5.131\";  \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ public function sendQueryVk($method, $dataQuery) { $dataQuery[\"access_token\"] = $this->token; $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } }  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441. \u041c\u0430\u0441\u0441\u0438\u0432\u00a0<strong>$arrQuery<\/strong>\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<strong>sendQueryVk<\/strong>. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0430\u0435\u0442 API \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u201c\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u201d.<\/p>\n<pre><code>$vkBot = new BotsTime_AutopostingVk(); $arrQuery = [     \"message\" => \"\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c\", ]; $dataResult = $vkBot->sendQueryVk(\"wall.post\", $arrQuery);<\/code><\/pre>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u2013\u00a0<strong>BotsTime_AutopostingVk<\/strong>. \u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<h4>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>\/* method - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435) dataQuery - \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ public function sendQueryVk_POST($method, $dataQuery = array()) { \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ $dataQuery[\"access_token\"] = $this->token; \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 *\/ $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } }<\/code><\/pre>\n<h4>\u00a0\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>public function sendQueryVk_GET($method, $dataQuery = array()) { $dataQuery[\"access_token\"] = $this->token; $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}?\" . http_build_query($dataQuery)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  return $html; }<\/code><\/pre>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/h4>\n<pre><code>\/* \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0417\u0410\u041f\u0418\u0421\u0418 *\/ public function send_wall_post($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id;  return $this->sendQueryVk_POST(\"wall.post\", $dataQuery); }  \/* \u0414\u041b\u042f \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u042f URL \u0414\u041b\u042f \u0417\u0410\u0413\u0420\u0423\u0417\u041a\u0418 *\/ public function send_photos_getWallUploadServer($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id; return $this->sendQueryVk_POST(\"photos.getWallUploadServer\", $dataQuery); }  \/* \u0414\u041b\u042f \u0421\u041e\u0425\u0420\u0410\u041d\u0415\u041d\u0418\u042f \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u042f \u041d\u0410 \u0421\u0415\u0420\u0412\u0415\u0420\u0415 VK *\/ public function send_photos_saveWallPhoto($dataQuery) { return $this->sendQueryVk_GET(\"photos.saveWallPhoto\", $dataQuery); }<\/code><\/pre>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u0441\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 3 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439, \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/* urlFile - \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 *\/ public function sendPhotoInVk($urlFile) { \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 *\/ $arrQuery = [ \"group_id\" =&amp;gt; $this-&amp;gt;group_id, ]; $dataUploadParams = $this-&amp;gt;send_photos_getWallUploadServer($arrQuery); $uploadUrl = $dataUploadParams[\"response\"][\"upload_url\"]; \/* -------------------- *\/   \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 *\/ $curl_photo = curl_file_create($urlFile); $arrQuery = [ \"photo\" =&amp;gt; $curl_photo ];  $ch = curl_init($uploadUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $arrQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $dataUploadParams = curl_exec($ch); curl_close($ch);  $dataImage = json_decode($dataUploadParams, true); \/* -------------------- *\/  \/* \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0433\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 *\/ $dataImage[\"group_id\"] = $this-&amp;gt;group_id; $dataSaveParams = $this-&amp;gt;send_photos_saveWallPhoto($dataImage); $dataImage = json_decode($dataSaveParams, true);  $codeQueryImage = \"photo{$dataImage['response'][0]['owner_id']}_{$dataImage['response'][0]['id']}\"; return $codeQueryImage;  }<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>class BotsTime_AutopostingVk { public $token = \"97a1b7bff17bd61309c109a4ac02961fe8a5121e553b95eca754e8e889f7dbb4fe\"; public $owner_id = -209546094; public $group_id = 209546094; public $idApp = 8054058; public $versionVk = \"5.131\"; \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 POST \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ \/* method - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435) dataQuery - \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ public function sendQueryVk_POST($method, $dataQuery = array()) { \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ $dataQuery[\"access_token\"] = $this-&amp;gt;token; \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 *\/ $dataQuery[\"v\"] = $this-&amp;gt;versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 GET \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ public function sendQueryVk_GET($method, $dataQuery = array()) {  $dataQuery[\"access_token\"] = $this-&amp;gt;token; $dataQuery[\"v\"] = $this-&amp;gt;versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}?\" . http_build_query($dataQuery)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  return $html; } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0417\u0410\u041f\u0418\u0421\u0418 *\/ public function send_wall_post($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this-&amp;gt;owner_id;  return $this-&amp;gt;sendQueryVk_POST(\"wall.post\", $dataQuery); } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u042f URL \u0414\u041b\u042f \u0417\u0410\u0413\u0420\u0423\u0417\u041a\u0418 *\/ public function send_photos_getWallUploadServer($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this-&amp;gt;owner_id;  return $this-&amp;gt;sendQueryVk_POST(\"photos.getWallUploadServer\", $dataQuery); } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u0421\u041e\u0425\u0420\u0410\u041d\u0415\u041d\u0418\u042f \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u042f \u041d\u0410 \u0421\u0415\u0420\u0412\u0415\u0420\u0415 VK *\/ public function send_photos_saveWallPhoto($dataQuery) { return $this-&amp;gt;sendQueryVk_GET(\"photos.saveWallPhoto\", $dataQuery); } \/* -------------------- *\/   \/* \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u0415 \u041a\u041e\u0414\u0410 \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0419 *\/ \/* urlFile - \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 *\/ public function sendPhotoInVk($urlFile) { \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 *\/ $arrQuery = [ \"group_id\" =&amp;gt; $this-&amp;gt;group_id, ]; $dataUploadParams = $this-&amp;gt;send_photos_getWallUploadServer($arrQuery); $uploadUrl = $dataUploadParams[\"response\"][\"upload_url\"]; \/* -------------------- *\/  \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 *\/ $curl_photo = curl_file_create($urlFile); $arrQuery = [ \"photo\" =&amp;gt; $curl_photo ]; $ch = curl_init($uploadUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $arrQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $dataUploadParams = curl_exec($ch); curl_close($ch); $dataImage = json_decode($dataUploadParams, true); \/* -------------------- *\/  \/* \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0433\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 *\/ $dataImage[\"group_id\"] = $this-&amp;gt;group_id; $dataSaveParams = $this-&amp;gt;send_photos_saveWallPhoto($dataImage); $dataImage = json_decode($dataSaveParams, true);  $codeQueryImage = \"photo{$dataImage['response'][0]['owner_id']}_{$dataImage['response'][0]['id']}\"; return $codeQueryImage; }  } $vkBot = new BotsTime_AutopostingVk(); \/* \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 *\/ $urlFile = $_SERVER[\"DOCUMENT_ROOT\"] . \"\/upload\/resize_cache\/iblock\/a4b\/1000_750_1a3e675aea8ae1409484d226085c41199\/estvnvtyrj2z0h0kq5wghwk5yfugy1kq.jpg\"; $textPost = \"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \\n\"; \/* \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0430 *\/ urlFile); \/* \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 *\/ arrQuery);<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451!<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435 &#8212;\u00a0<a href=\"https:\/\/www.youtube.com\/c\/ProgTime\" rel=\"noopener noreferrer nofollow\">https:\/\/www.youtube.com\/c\/ProgTime<\/a>  <\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/657569\/\"> https:\/\/habr.com\/ru\/post\/657569\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0441\u0430\u0439\u0442\u0430 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435. \u0412\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435. \u0412\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 PHP.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0430\u0439\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 API.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013\u00a0<a href=\"https:\/\/vk.com\/apps?act=manage\" rel=\"noopener noreferrer nofollow\">https:\/\/vk.com\/apps?act=manage<\/a><\/p>\n<p>\u0414\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0421\u0430\u0439\u0442 -> API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c\u00a0<strong>Standalone-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0439\u0442\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0418 \u0432\u044b\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u0430\u043d\u043d\u044b\u0435: \u201c<strong>id \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/strong>\u201c, \u201c<strong>\u0417\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447<\/strong>\u201c, \u201c<strong>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/strong>\u201c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c Open API \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u043e\u043b\u044f\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043c\u0435\u043d \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u0430\u0440\u0441\u0435\u0440.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u0430\u0448\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>1. \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c URL \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.  <\/p>\n<pre><code>https:\/\/oauth.vk.com\/authorize?client_id=ID_\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u042f&amp;display=page &amp;redirect_uri=https:\/\/api.vk.com\/blank.html&amp;scope=offline,wall,photos &amp;response_type=code<\/code><\/pre>\n<p>2. \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u00a0<code>access_token<\/code>. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u044b\u0439 URL, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0432\u00a0<code>client_id<\/code>,\u00a0<code>client_secret<\/code>\u00a0\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u00a0<code>access_token<\/code>.<\/p>\n<pre><code>https:\/\/oauth.vk.com\/access_token?client_id=ID_\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u042f &amp;client_secret=\u0417\u0410\u0429\u0418\u0429\u0415\u041d\u041d\u042b\u0419_\u041a\u041b\u042e\u0427&amp;redirect_uri=https:\/\/api.vk.com\/blank.html &amp;code=\u0421\u0415\u041a\u0420\u0415\u0422\u041d\u042b\u0419_\u041a\u041e\u0414<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/h4>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 PHP \u043a\u043b\u0430\u0441\u0441 \u0438 \u043d\u0430\u0437\u043e\u0432\u0443 \u0435\u0433\u043e\u00a0<strong>BotsTime_AutopostingVk<\/strong><\/p>\n<pre><code>class BotsTime_AutopostingVk {         \/* \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 *\/ public $token = \"97a1b7bff17bd61309c109ac7e1231dasdfsdfe2dac84ac0254961fe8a5121e553b95eca754e8e889f7dbb4fe\";         \/* id \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f *\/ public $owner_id = -209887634; public $versionVk = \"5.131\";  \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ public function sendQueryVk($method, $dataQuery) { $dataQuery[\"access_token\"] = $this->token; $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } }  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441. \u041c\u0430\u0441\u0441\u0438\u0432\u00a0<strong>$arrQuery<\/strong>\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<strong>sendQueryVk<\/strong>. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0430\u0435\u0442 API \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u201c\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u201d.<\/p>\n<pre><code>$vkBot = new BotsTime_AutopostingVk(); $arrQuery = [     \"message\" => \"\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c\", ]; $dataResult = $vkBot->sendQueryVk(\"wall.post\", $arrQuery);<\/code><\/pre>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u2013\u00a0<strong>BotsTime_AutopostingVk<\/strong>. \u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<h4>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>\/* method - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435) dataQuery - \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ public function sendQueryVk_POST($method, $dataQuery = array()) { \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ $dataQuery[\"access_token\"] = $this->token; \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 *\/ $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } }<\/code><\/pre>\n<h4>\u00a0\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 GET \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 API \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>public function sendQueryVk_GET($method, $dataQuery = array()) { $dataQuery[\"access_token\"] = $this->token; $dataQuery[\"v\"] = $this->versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}?\" . http_build_query($dataQuery)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  return $html; }<\/code><\/pre>\n<h4>\u041c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e<\/h4>\n<pre><code>\/* \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0417\u0410\u041f\u0418\u0421\u0418 *\/ public function send_wall_post($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id;  return $this->sendQueryVk_POST(\"wall.post\", $dataQuery); }  \/* \u0414\u041b\u042f \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u042f URL \u0414\u041b\u042f \u0417\u0410\u0413\u0420\u0423\u0417\u041a\u0418 *\/ public function send_photos_getWallUploadServer($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this->owner_id; return $this->sendQueryVk_POST(\"photos.getWallUploadServer\", $dataQuery); }  \/* \u0414\u041b\u042f \u0421\u041e\u0425\u0420\u0410\u041d\u0415\u041d\u0418\u042f \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u042f \u041d\u0410 \u0421\u0415\u0420\u0412\u0415\u0420\u0415 VK *\/ public function send_photos_saveWallPhoto($dataQuery) { return $this->sendQueryVk_GET(\"photos.saveWallPhoto\", $dataQuery); }<\/code><\/pre>\n<h4>\u0410\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433 \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u0441\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 3 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439, \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/* urlFile - \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 *\/ public function sendPhotoInVk($urlFile) { \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 *\/ $arrQuery = [ \"group_id\" =&amp;gt; $this-&amp;gt;group_id, ]; $dataUploadParams = $this-&amp;gt;send_photos_getWallUploadServer($arrQuery); $uploadUrl = $dataUploadParams[\"response\"][\"upload_url\"]; \/* -------------------- *\/   \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 *\/ $curl_photo = curl_file_create($urlFile); $arrQuery = [ \"photo\" =&amp;gt; $curl_photo ];  $ch = curl_init($uploadUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $arrQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $dataUploadParams = curl_exec($ch); curl_close($ch);  $dataImage = json_decode($dataUploadParams, true); \/* -------------------- *\/  \/* \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0433\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 *\/ $dataImage[\"group_id\"] = $this-&amp;gt;group_id; $dataSaveParams = $this-&amp;gt;send_photos_saveWallPhoto($dataImage); $dataImage = json_decode($dataSaveParams, true);  $codeQueryImage = \"photo{$dataImage['response'][0]['owner_id']}_{$dataImage['response'][0]['id']}\"; return $codeQueryImage;  }<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043f\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/h4>\n<pre><code>class BotsTime_AutopostingVk { public $token = \"97a1b7bff17bd61309c109a4ac02961fe8a5121e553b95eca754e8e889f7dbb4fe\"; public $owner_id = -209546094; public $group_id = 209546094; public $idApp = 8054058; public $versionVk = \"5.131\"; \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 POST \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ \/* method - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435) dataQuery - \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ public function sendQueryVk_POST($method, $dataQuery = array()) { \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 *\/ $dataQuery[\"access_token\"] = $this-&amp;gt;token; \/* \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e API \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 *\/ $dataQuery[\"v\"] = $this-&amp;gt;versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}\"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataQuery); curl_setopt($ch, CURLOPT_HTTPHEADER, [\"Content-Type:multipart\/form-data\"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  if($html === false){ echo \"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \" . curl_error($curl); return false; } else{ return json_decode($html, true); } } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041e\u0422\u041f\u0420\u0410\u0412\u041a\u0418 GET \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412 *\/ public function sendQueryVk_GET($method, $dataQuery = array()) {  $dataQuery[\"access_token\"] = $this-&amp;gt;token; $dataQuery[\"v\"] = $this-&amp;gt;versionVk;  $ch = curl_init(\"https:\/\/api.vk.com\/method\/{$method}?\" . http_build_query($dataQuery)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, false); $html = curl_exec($ch); curl_close($ch);  return $html; } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0417\u0410\u041f\u0418\u0421\u0418 *\/ public function send_wall_post($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this-&amp;gt;owner_id;  return $this-&amp;gt;sendQueryVk_POST(\"wall.post\", $dataQuery); } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u042f URL \u0414\u041b\u042f \u0417\u0410\u0413\u0420\u0423\u0417\u041a\u0418 *\/ public function send_photos_getWallUploadServer($dataQuery) { $dataQuery[\"from_group\"] = \"1\"; $dataQuery[\"owner_id\"] = $this-&amp;gt;owner_id;  return $this-&amp;gt;sendQueryVk_POST(\"photos.getWallUploadServer\", $dataQuery); } \/* -------------------- *\/   \/* \u0414\u041b\u042f \u0421\u041e\u0425\u0420\u0410\u041d\u0415\u041d\u0418\u042f \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u042f \u041d\u0410 \u0421\u0415\u0420\u0412\u0415\u0420\u0415 VK *\/ public function send_photos_saveWallPhoto($dataQuery) { return $this-&amp;gt;sendQueryVk_GET(\"photos.saveWallPhoto\", $dataQuery); } \/* -------------------- *\/   \/* \u041f\u041e\u041b\u0423\u0427\u0415\u041d\u0418\u0415 \u041a\u041e\u0414\u0410 \u0414\u041b\u042f \u041f\u041e\u0421\u0422\u0418\u041d\u0413\u0410 \u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0419 *\/ \/* urlFile - \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 *\/ public function sendPhotoInVk($urlFile) { \/* \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 *\/ $arrQuery = [ \"group_id\" =&amp;gt; $this-&amp;gt;group_id, ]; $dataUploadParams = $this-&amp;gt;send_photos_getWallUploadServer($arrQuery); $uploadUrl =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-331097","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331097","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=331097"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331097\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}