Posting message using Facebook SDK for PHP -


hello i'm working php code using facebook sdk post message on facbook page admin it's ok when work in localhost when hosted page on web server gives me following error:

 fatal error: class 'facebook\facebooksession' not found in /var/www/simo/index.php on line 48 

the lines of code cause problem:

use facebook\facebookredirectloginhelper; use facebook\facebooksession; use facebook\facebookrequest;  require "vendor/autoload.php";  session_start(); $appid='358738637667835'; $appsecret='92841aa4b36c9c37a4d779e801db3d6f'; facebooksession::setdefaultapplication($appid,$appsecret);//(line 48) 

the thing should noted version of server’s php “php 5.4.39” understands instruction "use".

thank giving me solution or suggestion.

this problem happens result of incorrect paths. if downloaded php sdk , make sure contains file called "autoload.php", add following line

require __dir__ . '/facebook-php-sdk/autoload.php'; 

before "use statement"

use facebook\facebookredirectloginhelper; use facebook\facebooksession; 

the autoload.php fix paths , mapping you


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -