好吧,我發現(我不明白-1雖然,這個問題的目的是知道我是在正確的軌道上做到這一點):
function fb_event_crawler_node_load($nodes, $types) {
foreach ($nodes as $node) {
if ($node->type=="event"){
$fb_url = $node->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
. "&client_secret=" . $app_secret
. "&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);
}
}
}