1
function generateAppRequest() {

 try{

   $app_id = '';
   $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 ='';

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

   $result = file_get_contents($apprequest_url);
   echo("App Request sent?", $result);

}

catch(Exception $e){
   echo 'Message: ' .$e->getMessage();
}
}

The above code for app generated request does not work. The app does not display anything. Event the exception is not displayed. I am running the app on heroku platform

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
aas2909
  • 136
  • 4

1 Answers1

0

Here some thoughts you should look at :

  • Are you sure the Heroku platform allows you to go hit facebook webservers ?
  • Maybe fopen and file_get_contents are restricted to regular files on Heroku platform, try the Curl library to access distant URLs.

Good luck with your project

Thibault
  • 1,566
  • 15
  • 22