Gregory-Turtle
Gregory-Turtle

Reputation: 1717

Facebook app notification request is blocked

I am working on a Facebook application and I am having trouble sending notifications to users of my app. I reviewed the answers to similar questions on this site and I consulted the Facebook SDK page and tried to apply the following strategy:

<?php 

$app_id = YOUR_APP_ID;
$app_secret = YOUR_APP_SECRET;

$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $app_id .
"&client_secret=" . $app_secret .
"&grant_type=client_credentials";

$app_access_token = file_get_contents($token_url);

$user_id = THE_CURRENT_USER_ID;

$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='INSERT_UT8_STRING_MSG'" . 
"&data='INSERT_STRING_DATA'&"  .   
$app_access_token . "&method=post";

$result = file_get_contents($apprequest_url);
echo $result;

?>

All I get is an error on my second call to file_get_contents. The error states:

failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden\r\n

Can anyone give me an idea of what's going on? My first request to graph.facebook.com worked just fine.

Upvotes: 1

Views: 432

Answers (1)

Mattios550
Mattios550

Reputation: 372

  1. Check Facebook is doing OK: Does Facebook Platform Live Status have any relevant information?
  2. Check you have no connection issues with facebook.com in HTTPS: Can you open the URL of the social graph for Facebook Platform's page in your browser?
  3. Check again if the actual URL you're trying to access works and the URL is correct.
  4. Come back here and update the question with the problematic URL and the exact method you're trying to access, or contact Facebook Platform support.

stolen from Facebook graph api doesnt response

Upvotes: 2

Related Questions