{"id":161305,"date":"2012-12-04T13:07:03","date_gmt":"2012-12-04T09:07:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=161305"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=161305","title":{"rendered":"<span class=\"post_title\">Google Cloud Messaging \u2013 \u043f\u0438\u0448\u0435\u043c backend \u043d\u0430 PHP<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435  <\/p>\n<ul>\n<li>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438<\/li>\n<li>\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0434\u043e 4096\u043a\u0431 \u043a\u0430\u0436\u0434\u044b\u0439.<\/li>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/li>\n<li>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0438 \u0437\u043d\u0430\u0435\u0442:<br \/> \n<ul>\n<li>\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 <\/li>\n<li>\u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438<\/li>\n<\/ul>\n<p>   <\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>Google Cloud Messaging \u2013 \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0438 \u044f\u0441\u043d\u043e<\/h4>\n<p>  GCM \u2013 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c polling \u0438 long polling, \u043d\u043e \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f, \u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0430\u044f \u0438\u0445. \u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0438, \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0413\u0443\u0433\u043b \u043d\u0435 \u0434\u0430\u0435\u0442 (\u0445\u043e\u0442\u044f \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u0442\u0430\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u043a\u043e\u043c C2DM). \u0415\u0441\u043b\u0438 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d, \u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0430 GCM \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u043e 4\u0445 \u043d\u0435\u0434\u0435\u043b\u044c. \u0422.\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u0443\u0435\u0445\u0430\u043b \u0432 \u043e\u0442\u043f\u0443\u0441\u043a, \u0442\u043e \u043f\u043e \u043f\u0440\u0438\u0435\u0437\u0434\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 GCM \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 polling \u2013 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 http \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0435 N \u043c\u0438\u043d\u0443\u0442.<\/p>\n<p>  \u041b\u044e\u0431\u043e\u0435 android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 GCM. \u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 GCM \u0441\u0435\u0440\u0432\u0435\u0440\u0430 RegistrationId, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Devices, \u0445\u0440\u0430\u043d\u044f\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438\u0445 RegistrationId.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c POST \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 GCM \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json (\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447 =&gt; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e json). \u041e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 json, \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043a\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0438.<\/p>\n<h4>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 GcmPayload \u0438 GcmSender.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class GcmPayload {    public function __construct($regId, $jsons) {}    public $regId;    public $jsons; } class GcmSender {    public function __construct($payloads) {}    public function send() {}    protected function getPackages() {}    protected function isReadyToFlush($items, $json) {}    public function onResponse($response, $info, RollingCurlRequest $request) {} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 GCM payload \u2013 \u044d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0430 data \u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 4096 \u0431\u0430\u0439\u0442. <a href=\"http:\/\/developer.android.com\/google\/gcm\/gcm.html#request\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/a>.<\/p>\n<p>  GcmPayload \u2013 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0434\u043d\u043e\u0433\u043e RegistrationId. \u041f\u043e\u043b\u0435 $jsons \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c json\u2019\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">$recipients = $messagesRepository-&gt;getRecipientsWithNewMessages(); $payloads = array(); foreach ($recipients as $recipient) {     $jsons = array();     foreach ($recipient-&gt;messages as $message) {         $jsons[] = json_encode($message);     }     $payloads[] = new GcmPayload($recipient[\u2018regId\u2019], $jsons); }  $gcm = new GcmSender(); $gcm-&gt;send($payloads); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>GcmSender<\/h4>\n<h5>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u0447\u043b\u0435\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u0430<\/h5>\n<p>   const GCM_API_KEY = &#8216;your api key&#8217;; \/\/ \u041d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 Google APIs Console<br \/>   const CURL_TIMEOUT = 10; \/\/ \u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0413\u0443\u0433\u043b \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445<br \/>   const GCM_MAX_DATA_SIZE = 4096; \/\/\u041b\u0438\u043c\u0438\u0442 \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445<br \/>   const GCM_SERVER_URL = &#8216;https:\/\/android.googleapis.com\/gcm\/send&#8217;; \/\/\u0430\u0434\u0440\u0435\u0441 GCM \u0441\u0435\u0440\u0432\u0435\u0440\u0430<br \/>   const GCM_MAX_CONNECTIONS = 10; \/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<p>  const KEY_REG_IDS = &#8216;registration_ids&#8217;; \/\/\u043a\u043b\u044e\u0447 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 json \u0437\u0430\u043f\u0440\u043e\u0441\u0435<br \/>   const KEY_DATA = &#8216;data&#8217;; \/\/\u043a\u043b\u044e\u0447 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 json \u0437\u0430\u043f\u0440\u043e\u0441\u0435<br \/>   const KEY_ITEMS = &#8216;items&#8217;; \/\/\u043a\u043b\u044e\u0447 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 data, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<br \/>   const REGID_PLACEHOLDER = &#8216;_REGID_&#8217;; \/\/\u043f\u043b\u044d\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 \u0434\u043b\u044f RegistrationId \u0432 json \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<br \/>   const ITEMS_PLACEHOLDER = &#8216;_ITEMS_&#8217;; \/\/\u043f\u043b\u044d\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 json \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const GCM_ERROR_NOTREGISTERED = &#8216;NotRegistered&#8217;; \/\/\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0434\u0430\u043b\u0438\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<p>  protected $_template; \/\/json \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430<br \/>   protected $_baseDataSize; \/\/\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043b\u044e\u0447 items, \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u0441\u043a\u043e\u0431\u043a\u0438 \u0438 \u0442.\u0434.<\/p>\n<h5>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440<\/h5>\n<p>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 getPackages. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442\u044c \u043b\u0438\u043c\u0438\u0442 \u0432 4096 \u0431\u0430\u0439\u0442 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435: {\u00abitems\u00bb: []}<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    public function __construct() {         $dataObj = '{&quot;'.self::KEY_ITEMS.'&quot;: ['.self::ITEMS_PLACEHOLDER.']}';         $this-&gt;_template = '{             &quot;'.self::KEY_REG_IDS.'&quot;: [&quot;'.self::REGID_PLACEHOLDER.'&quot;],             &quot;'.self::KEY_DATA.'&quot;: '.$dataObj.'         }';         $baseDataJson = str_replace(self::ITEMS_PLACEHOLDER, '', $dataObj);         $this-&gt;_baseDataSize = strlen($baseDataJson);     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h5>\u041c\u0435\u0442\u043e\u0434 send<\/h5>\n<p>  \u042d\u0442\u043e \u043f\u0430\u0431\u043b\u0438\u043a \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 GCM \u0441\u0435\u0440\u0432\u0435\u0440. \u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c getPackages \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u2013 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 post \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json (\u043e\u0434\u0438\u043d \u043f\u0430\u043a\u0435\u0442 \u2013 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441) \u0438 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0435 4096 \u0431\u0430\u0439\u0442. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u2013 \u044d\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"http:\/\/code.google.com\/p\/rolling-curl\/\">RollingCurl<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 curl_multi_exec \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. RollingCurl \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438\u043c \u043a\u043e\u043b\u0431\u044d\u043a \u043c\u0435\u0442\u043e\u0434\u043e\u043c onResponse, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    \/**      * @param GcmPayload[] $payloads      *\/     public function send($payloads) {         $packages = self::getPackages($payloads);         if (!$packages || count($packages) == 0) return;          $rc = new RollingCurl(array($this, 'onResponse'));         $headers = array('Authorization: key='.self::GCM_API_KEY, 'Content-Type: application\/json');         $rc-&gt;__set('headers', $headers);         $rc-&gt;options = array(             CURLOPT_SSL_VERIFYPEER =&gt; false, \/\/\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430             CURLOPT_RETURNTRANSFER =&gt; true, \/\/\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438             CURLOPT_CONNECTTIMEOUT =&gt; self::CURL_TIMEOUT, \/\/ \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435             CURLOPT_TIMEOUT =&gt; self::CURL_TIMEOUT); \/\/\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 curl          foreach ($packages as $package) {             $rc-&gt;request(self::GCM_SERVER_URL, 'POST', $package);         }                  $rc-&gt;execute(self::GCM_MAX_CONNECTIONS);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h5>\u041c\u0435\u0442\u043e\u0434 getPackages<\/h5>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0443 payload\u2019\u043e\u0432 \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043f\u0430\u043a\u0435\u0442 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043b\u0438\u043c\u0438\u0442 \u0432 4096 \u0431\u0430\u0439\u0442 \u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0430\u0442\u0441\u044f. \u041a\u0441\u0442\u0430\u0442\u0438, \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u043a\u0435\u0442 \u2013 \u043e\u0434\u0438\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0430\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u0430 \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443. \u041d\u043e \u0432 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u0431\u0435\u0441\u0435\u0434\u0430\u0445 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u044f\u043c \u0438 GCM \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0432 \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0430 registration_ids \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e RegistrationId. \u041d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c.<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 getPackages. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u0434\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f isReadyToFlush, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e json \u043a \u043f\u0430\u043a\u0435\u0442\u0443 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u043b\u0438\u043c\u0438\u0442\u0430 \u0432 4096 \u0431\u0430\u0439\u0442. \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043f\u0430\u043a\u0435\u0442 \u0442\u0443\u0442 \u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0438 \u044d\u0442\u043e\u0442 json \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0443\u0436\u0435 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    \/**      * @param string $items      * @param string $json      * @return bool      *\/     protected function isReadyToFlush($items, $json) {         $newPackageLen = $this-&gt;_baseDataSize + strlen($items) + strlen($json);         return $newPackageLen &gt; self::GCM_MAX_DATA_SIZE;     }      \/**      * @param GcmPayload[] $payloads      * @return string[]      *\/     protected function getPackages($payloads) {         $packages = array();         foreach($payloads as $payload) {             $template = str_replace(self::REGID_PLACEHOLDER, $payload-&gt;regId, $this-&gt;_template);             $items = '';              foreach($payload-&gt;jsons as $json) {                 if ($this-&gt;isReadyToFlush($items, $json)) {                     $package = str_replace(self::ITEMS_PLACEHOLDER, $items, $template);                     $packages[] = $package;                     $items = '';                 }                 if ($items) $items .= ','.$json;                 else $items = $json;             }              if ($items) { \/\/\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442                 $package = str_replace(self::ITEMS_PLACEHOLDER, $items, $template);                 $packages[] = $package;             }         }          return $packages;     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h5>\u041c\u0435\u0442\u043e\u0434 onResponse<\/h5>\n<p>  \u0412\u0430\u0436\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043b\u0438 \u043e\u043d\u043e, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0442\u043e \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435. onResponse \u2013 \u044d\u0442\u043e \u0442\u043e\u0442 \u043a\u043e\u043b\u0431\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 RollingCurl \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 send. \u041a\u043e\u043b\u0431\u0435\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:  <\/p>\n<ol>\n<li>$response \u2013 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438<\/li>\n<li>$info \u2013 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 curl_getinfo <a href=\"http:\/\/php.net\/manual\/en\/function.curl-getinfo.php\">php.net\/manual\/en\/function.curl-getinfo.php<\/a> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 http \u043a\u043e\u0434\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044f\u043c\u0438 \u0437\u0430\u043a\u0430\u0447\u043a\u0438\/\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043b\u0438\u0448\u044c http \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430. <\/li>\n<li>RollingCurlRequest $request \u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 $request-&gt;post_data<\/li>\n<\/ol>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043a\u0440\u0430\u0441\u043d\u043e\u0440\u0435\u0447\u0438\u0432\u0435\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    \/**      * @param string $response      * @param array $info      * @param \\RollingCurl\\RollingCurlRequest $request      *\/     public function onResponse($response, $info, RollingCurlRequest $request) {        \/\/\u042d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435        $success = true; \/\/\u0414\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 json, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0432 post         $post = json_decode($request-&gt;post_data, true);         if (json_last_error() != JSON_ERROR_NONE) {             \/\/\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c json \u043e\u0448\u0438\u0431\u043a\u0443, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u044b \u043d\u0430\u043a\u043e\u0441\u044f\u0447\u0438\u043b\u0438 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435.             return;         } \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c RegistratonId \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438          $regId = $post[self::KEY_REG_IDS][0];         $items = $post[self::KEY_DATA][self::KEY_ITEMS]; \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430         $code = $info != null && isset($info['http_code']) ? $info['http_code'] : 0; \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u043a\u043e\u0434\u0430: 2, 3, 4, 5         $codeGroup = (int)($code \/ 100);          if ($codeGroup == 5) { \/\/\u0415\u0441\u043b\u0438 \u043a\u043e\u0434 5xx, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e GCM \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \/\/TODO \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Retry-After             $success = false;         }         if ($code !== 200) {             \/\/\u041e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 http \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e             \/\/\u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u043e\u0432 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 http:\/\/developer.android.com\/google\/gcm\/gcm.html#response             $success = false;         }         if (!$response || strlen(trim($response)) == null) {             \/\/\u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0442\u0432\u0435\u0442, \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e.             $success = false;         }  \/\/\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u0442\u0432\u0435\u0442, \u0441\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 http:\/\/developer.android.com\/google\/gcm\/gcm.html#success         if ($response) {             $json = json_decode($response, true);             if (json_last_error() != JSON_ERROR_NONE) {                 \/\/\u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 json \u043e\u0442\u0432\u0435\u0442\u0430, \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e                 $success = false;                 $json = array();             }         }         else {             $json = array();             $success = false;         }  \/\/ failure \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u043e\u0434\u0438\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 failure \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043b\u0438\u0431\u043e 0 \u043b\u0438\u0431\u043e 1)         $failure = isset($json['failure']) ? $json['failure'] : null; \/\/ canonical_ids \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u0435\u0439, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c RegistrationId (\u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 failure - \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u0431\u043e 0 \u043b\u0438\u0431\u043e 1).          $canonicalIds = isset($json['canonical_ids']) ? $json['canonical_ids'] : null; \/\/\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e, \u0442\u043e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 $success=true \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e         if ($failure || $canonicalIds) { \/\/results \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u043e\u0434\u0438\u043d, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u0441\u043c\u0435\u043d\u044b RegistrationId)            $results = isset($json['results']) ? $json['results'] : array();             foreach($results as $result) {                 $newRegId = isset($result['registration_id']) ? $result['registration_id'] : null;                 $error = isset($result['error']) ? $result['error'] : null;                 if ($newRegId) {  \/\/ \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c $regId \u043d\u0430 $newRegId;                 }                 else if ($error) {                     if ($error == self::GCM_ERROR_NOTREGISTERED) {                         \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c $regId \u0438\u0437 \u0431\u0430\u0437\u044b;                     }                     else {                         \/\/\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u0435\u0451 \/\/\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438, \u0442\u043e \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c http:\/\/developer.android.com\/google\/gcm\/gcm.html#error_codes                     }                     $success = false;                 }             } \/\/\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043d\u0435\u0442. } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0431\u0430\u0437\u0435, \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e. \u041d\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430 GCM \u0441\u0435\u0440\u0432\u0435\u0440 \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0432 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043e\u0442\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0432 onResponse \u043d\u0435\u043b\u044c\u0437\u044f. \u0422\u043e\u0433\u0434\u0430 \u0433\u0434\u0435? \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u043b\u0438\u043d\u0433\u043e\u043c. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430. \u041d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043b\u0438 \u0443\u0436\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0435\u0441\u043b\u0438 \u0434\u0430 \u2013 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445. \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043b\u044e\u0441 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u2013 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c, \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b. \u041c\u0438\u043d\u0443\u0441\u044b \u2013 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0441\u0445\u043e\u0434 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0435\u0451 <a href=\"http:\/\/developer.android.com\/guide\/google\/gcm\/index.html\">\u043a \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e<\/a>.<\/p>\n<h4>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043b\u044f \u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439, \u043d\u043e \u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0441\u0440\u043e\u043a\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044d\u043a\u044d\u043d\u0434\u0430 \u0432\u0430\u0448\u0435\u0433\u043e android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/161305\/\"> http:\/\/habrahabr.ru\/post\/161305\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435  <\/p>\n<ul>\n<li>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438<\/li>\n<li>\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0434\u043e 4096\u043a\u0431 \u043a\u0430\u0436\u0434\u044b\u0439.<\/li>\n<li>\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/li>\n<li>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0438 \u0437\u043d\u0430\u0435\u0442:<br \/> \n<ul>\n<li>\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 <\/li>\n<li>\u0442\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438<\/li>\n<\/ul>\n<p>   <\/li>\n<\/ul>\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-161305","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161305","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=161305"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161305\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}