Reputation: 312
I can send a notification to all user that access my APP, using userid stored in a table "fbuid", and all works fine.
But if an user remove my APP the code fail and nobody get notification. How can I solve this problem.
$app_id = 'AAAAAAAA';
$app_secret = 'BBBBBBBBBBBBBB';
$app_access_token = $app_id . '|' . $app_secret;
$query = pg_query($dbconn, "SELECT * FROM fbuid;");
while ($row = pg_fetch_row($query))
{
$response = $facebook->api( '/'.$row[1].'/notifications', 'POST', array(
'template' => 'Nuovo Annuncio Pubblicato FaiceBuy',
'access_token' => $app_access_token
));
}
Upvotes: 0
Views: 139
Reputation: 20753
That means that the code skips due to exception thrown after failing in 1 case. So, you should write your code in try-catch block, just like this-.
while ($row = pg_fetch_row($query))
{
try
{
$response = $facebook->api( '/'.$row[1].'/notifications', 'POST', array(
'template' => 'Nuovo Annuncio Pubblicato FaiceBuy',
'access_token' => $app_access_token
));
echo '<pre>Post ID: ' . $response ['id'] . '</pre>';
}
catch(FacebookApiException $e)
{
echo $e->getMessage();
}
}
Upvotes: 1