Send Facebook Notification via Graph API using PHP



function fbnotification($userid,$message)
{
$app_id = "<APPLICATION_ID>";
$app_secret = "<APPLICATION_SECRET_KEY>";
$app_access_token = $app_id . '|' . $app_secret;

$facebook = new Facebook(array(
'appId'  => $app_id,
'secret' => $app_secret,
'cookie' => true,
));

$response = $facebook->api( '/'.$userid.'/notifications', 'POST', array(
'template' => $message,
'access_token' => $app_access_token
) );  
}

fbnotification($userid,$message)

0 comments :