/ Published in: PHP
How to post a notification to Facebook's Graph API.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Use your APP ID and APP Secret from developer.facebook.com/apps /** * Send Facebook notification using CURL * @param string $recipientFbid Scoped recipient's FB ID * @param string $text Text of notification (<150 chars) * @param string $url Relative URL to use when user clicks the notification * @return String */ function sendNotification($recipientFbid, $text, $url) { $post_data = "access_token=". FB_APP_TOKEN ."&template={$text}&href={$href}"; curl_setopt($curl, CURLOPT_URL, "https://graph.facebook.com/v2.1/". $recipientFbid ."/notifications"); return $data; }