简体   繁体   English

阅读PHP中的Google Calendar API推送通知

[英]Read Google Calendar API Push Notification in PHP

I have successfully configured Google API Calendar Event Change Push Notifications. 我已经成功配置了Google API日历事件更改推送通知。 My notification page gets called as it should be when I set up the notification or change the calendar. 设置通知或更改日历时,将通知我的通知页面。

BUT...being a bit of a PHP dunce I don't understand how to see the content of the notification. 但是...有点像PHP笨拙,我不明白如何查看通知的内容。

SO (MAIN QUESTION)...how do I get at the variables in the notification? 所以(主要问题)...如何获取通知中的变量? The notification calls my designated page. 该通知将呼叫我的指定页面。 What are the variables? 有哪些变量? How are they sent? 他们如何发送? How are they organized? 他们是如何组织的?

There is the larger question of how one should determine the content of a call to a page in PHP. 还有一个更大的问题,即如何确定PHP中对页面的调用的内容。 I tried all manner of var_dump, print_r, etc. All I get with: 我尝试了各种方式的var_dump,print_r等。

<?php
$arr = get_defined_vars();
error_log(print_r($arr),0);
?>

is: 1 Yes, just the number 1 in my error_log. 是:1是,仅是我的error_log中的数字1。

The way I read the respose is: 我读的respose的方式是:

$content = apache_request_headers();

If you print $content the data is self explenatory. 如果打印$ content,则数据是自说明的。 However; 然而; for more information hwo to read the header check the link below: 有关更多信息,请参见下面的链接以阅读标题:

https://developers.google.com/google-apps/calendar/v3/push#receiving https://developers.google.com/google-apps/calendar/v3/push#receiving

Thanks. 谢谢。 it's working. 它正在工作。 i wrote to file. 我写了文件。

    $content = apache_request_headers();
    get_contents($content);
    function get_contents($result) {
        $fp = fopen('config.json', 'w');
        fwrite($fp, json_encode($result));
        fclose($fp);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM