我的应用程序可以在我的 Facebook 页面上获取 Facebook 帖子、评论、回复和对话。因此,应用程序(服务)不间断地运行以检查该页面上的新项目(发布/评论/回复/对话),当达到 fb API(不间断服务)的请求限制时,我的 facebook 应用程序已超时任何 30 分钟的请求。
我已阅读有关 facebook Real-time API 的信息。当 FB 对通知有任何更改时,它会向我们发送通知,我已经尝试过,但我没有从 FB 得到任何有用的回复。任何人都可以请显示我的错误在哪里。
我使用以下方法发布 FB 订阅:
Page_ID/subscriptions?access_token=My_APP_Token&object=page&fields=feed&callback_url=211.25.3.235/php/verify.php&verify_token=anbiz
然后在我的本地代码(verify.php):
<?php
define('VERIFY_TOKEN', 'anbiz');
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe' && $_GET['hub_verify_token'] == VERIFY_TOKEN)
{
echo $_GET['hub_challenge'];
}
else if ($method == 'POST')
{
$updates = json_decode(file_get_contents("php://input"), true);
file_put_contents('updates.txt', print_r($updates) , FILE_APPEND);
$strword = array($updates);
$count = count($strword);
$count = count($pieces);
$myfile = fopen("count.txt", "w") or die("Unable to open file!");
fwrite($myfile, $count);
fclose($myfile);
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $updates);
fclose($myfile);
}
还有一件事,有没有办法通过使用 C# 编程语言来获得这个订阅?
请帮忙。先感谢您。