Get Facebook content from node_load() I want a content type having a field "FB URL" that get the URL of a Facebook Event and that when people load a node of this type, the content of the facebook event is retrieved through FB API. It cannot be retrieved from the database because the content must be up to date with the one on facebook.

So far, I created a module with node_load() to add content while the node is loaded but I don't know what function to call from FBOauth module to do so... Before that, I tried with a simple file_get_contents(); that worked well until the access token from the FB App expired and didn't know how to get a new one dynamically.

I think I'm getting lost so could anyone guide me on how to do that?

Thanks a lot!
Ok, I found!

function fb_event_crawler_node_load($nodes, $types) {
    foreach ($nodes as $node) {
        if ($node-&gt;type=="event"){
            $fb_url = $node-&gt;field_event_url['und'][0]['value'];
            $url = parse_url($fb_url);
            if (!$url['host'] == 'www.facebook.com'){
                echo t('This is not a Facebook URL');
            }

            $path_exploded = explode("/", $url['path']);
            if (!$path_exploded[1] == 'events'){
                echo t("This is not a Facebook event page!");
            }

            $fb_event_id=$path_exploded[2];

                // dpm($path_exploded);


            $app_id = isset($app_id) ? $app_id : variable_get('fboauth_id', '');
            $app_secret = isset($app_secret) ? $app_secret : variable_get('fboauth_secret', '');
            $app_token_url = "https://graph.facebook.com/oauth/access_token?"
            . "client_id=" . $app_id
            . "&amp;client_secret=" . $app_secret 
            . "&amp;grant_type=client_credentials";

            $response = file_get_contents($app_token_url);
            $params = null;
            parse_str($response, $params);
            $access_token=$params['access_token'];

                //echo($params['access_token']);

            $fbquery = fboauth_graph_query($fb_event_id."/", $access_token);

            dpm($fbquery);
        }
    }
}