Welcome Guest, Not a member yet? Register   Sign In
Content is not show at Facebook wall, got blank page
#1

I'm trying to share content from a CI3 application. I'm using
Code:
"facebook/php-sdk-v4": "4.0.21"
in composer.json file for SDK libraries. This is the code I have based on [this][1] blog post:

PHP Code:
use Facebook\FacebookSession;
    use 
Facebook\FacebookRequest;
    use 
Facebook\FacebookRequestException;
    use 
Facebook\GraphObject;
    
    class 
ShareFacebook extends CI_Controller
    
{
        private 
$facebookAccessToken;
        private 
$defaultPermissions = array( 'publish_actions' );
    
        public function 
__construct()
        {
            
parent::__construct();
    
            
// Initialize the SDK
            
FacebookSession::setDefaultApplication(
                
$this->config->item'facebook_app_id' ),
                
$this->config->item'facebook_app_secret' )
            );
    
            
$this->facebookAccessToken = new FacebookSession$this->config->item'facebook_app_client_token' ) );
        }
    
        public function 
index()
        {
            try {
    
                
$request = (
                new 
FacebookRequest(
                    
$this->facebookAccessToken'POST''/me/feed', array(
                        
'message' => 'User provided message'
                    
)
                )
                )->
execute();
    
                
$response $request->getGraphObject()->asArray();
                
print_r$response );
            } catch ( 
FacebookRequestException $e ) {
                echo 
"Exception occured, code: ".$e->getCode();
                echo 
" with message: ".$e->getMessage();
            }
        }
    } 

But when I execute the method I got a blank page with no errors in Apache logs or so on and content is not show at my Facebook wall, what I'm missing?

[1]: http://www.benmarshall.me/facebook-sdk-php-v4/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB