Reputation: 1717
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
Reputation: 372
stolen from Facebook graph api doesnt response
Upvotes: 2