source/php/Module/Social/Feed.php
public function getFacebookUser()
    {

        /**
         * Request a token from Facebook Graph API
         */
        $endpoint = 'https://graph.facebook.com/oauth/access_token';
        $data = array(
            'grant_type'    => 'client_credentials',
            'client_id'     => $this->args['api_user'],
            'client_secret' => $this->args['api_secret']
        );

        $curl = new \Modularity\Helper\Curl();
        $token = $curl->request('GET', $endpoint, $data);

        if (strpos($token, 'error') !== false) {
            $error = json_decode($token);
            return $error;
        }

        //Decode token
        $token = json_decode($token);

        /**
         * Request the posts
         */
        $endpoint = 'https://graph.facebook.com/' . $this->args['query'] . '/posts';
        $data = array(
            'access_token' => $token->access_token,
            'fields'       => 'from, full_picture, picture, message, created_time, object_id, link, name, caption, description, icon, type, status_type, likes'
        );
        $feed = $curl->request('GET', $endpoint, $data);

        //Valid data object
        if(isset(json_decode($feed)->data)) {
            return json_decode($feed)->data;
        }

        //Return whatever exists, let error handler fix the rest. 
        return json_decode($feed);
    }
public function getFacebookUser()
    {

        /**
         * Request a token from Facebook Graph API
         */
        $endpoint = 'https://graph.facebook.com/oauth/access_token';
        $data = array(
            'grant_type'    => 'client_credentials',
            'client_id'     => $this->args['api_user'],
            'client_secret' => $this->args['api_secret']
        );

        $curl = new \Modularity\Helper\Curl();
        $token = $curl->request('GET', $endpoint, $data);

        if (strpos($token, 'error') !== false) {
            $error = json_decode($token);
            return $error;
        }

        //Decode token
        $token = json_decode($token);

        /**
         * Request the posts
         */
        $endpoint = 'https://graph.facebook.com/' . $this->args['query'] . '/posts';
        $data = array(
            'access_token' => $token->access_token,
            'fields'       => 'from, full_picture, picture, message, created_time, object_id, link, name, caption, description, icon, type, status_type, likes'
        );
        $feed = $curl->request('GET', $endpoint, $data);

        //Valid data object
        if(isset(json_decode($feed)->data)) {
            return json_decode($feed)->data;
        }

        //Return whatever exists, let error handler fix the rest. 
        return json_decode($feed);
    }
public function getFacebookUser ( ) { /**
         * Request a token from Facebook Graph API
         */ $ endpoint = 'https://graph.facebook.com/oauth/access_token' ; $ data = array ( 'grant_type' => 'client_credentials' , 'client_id' => $ this -> args [ 'api_user' ] , 'client_secret' => $ this -> args [ 'api_secret' ] ) ; $ curl = new \ Modularity \ Helper \ Curl ( ) ; $ token = $ curl -> request ( 'GET' , $ endpoint , $ data ) ; if ( strpos ( $ token , 'error' ) !== false ) { $ error = json_decode ( $ token ) ; return $ error ; } //Decode token $ token = json_decode ( $ token ) ; /**
         * Request the posts
         */ $ endpoint = 'https://graph.facebook.com/' . $ this -> args [ 'query' ] . '/posts' ; $ data = array ( 'access_token' => $ token -> access_token , 'fields' => 'from, full_picture, picture, message, created_time, object_id, link, name, caption, description, icon, type, status_type, likes' ) ; $ feed = $ curl -> request ( 'GET' , $ endpoint , $ data ) ; //Valid data object if ( isset ( json_decode ( $ feed ) -> data ) ) { return json_decode ( $ feed ) -> data ; } //Return whatever exists, let error handler fix the rest.  return json_decode ( $ feed ) ; }
Get a Facebook user's feed
@return object Feed
Get a Facebook user s feed