You are here

function fboauth_method_invoke in Facebook OAuth (FBOAuth) 7

Same name and namespace in other branches
  1. 6 includes/fboauth.fboauth.inc \fboauth_method_invoke()

Execute a legacy REST API method through Facebook.

See also

http://developers.facebook.com/docs/reference/rest/

1 call to fboauth_method_invoke()
fboauth_action_deauth in includes/fboauth.fboauth.inc
Facebook OAuth callback for deauthorizing the site from Facebook.

File

includes/fboauth.fboauth.inc, line 887
Provides functions used during Facebook login processes.

Code

function fboauth_method_invoke($method, $access_token, $parameters = array()) {

  // Provide the default App ID for all requests if not specified.
  if (!isset($parameters['app_id'])) {
    $parameters['app_id'] = variable_get('fboauth_id', '');
  }
  $parameters['access_token'] = $access_token;

  // Keep all results in JSON for simplicity.
  $parameters['format'] = 'json';

  // Perform the REST query.
  $query_string = drupal_http_build_query($parameters);
  $result = drupal_http_request('https://api.facebook.com/v2.2/method/' . $method . '?' . $query_string);
  return json_decode($result->data);
}