好的,我发现(虽然我不明白 -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);
}
}
}