Facebook send notification from php -
i make website facebook notifications. tried send notification account. here code:
require 'facebook/autoload.php'; $facebook = new facebook\facebook(array( 'appid' => fb_app_id, 'secret' => fb_app_secret, )); $post = $facebook->api('/' . $user['uid'] . '/notifications/', 'post/v2.2/', array( 'access_token' => fb_app_id.'|'.fb_app_secret, 'href' => "http://mydomainlink.com", //this link app's root, don't think works, seems link app's canvas page 'template' => 'max 180 characters', 'ref' => 'notification sent '.date("y-m-d g:i:s") //this facebook's insight ));
and result:
fatal error: uncaught exception 'facebook\exceptions\facebooksdkexception' message 'required "app_id" key not supplied in config , not find fallback environment variable "facebook_app_id"' in /var/www/webpages/facebook/facebook.php:133 stack trace: #0 /var/www/webpages/fbnotify.php(14): facebook\facebook->__construct(array) #1 {main} thrown in /var/www/webpages/facebook/facebook.php on line 133
the users login website facebook, can userid there.
Comments
Post a Comment