You are here

public function OAuth2HTTPSBatch::getRaw in Feeds OAuth 6

Implementation of FeedsImportBatch::getRaw();

Overrides FeedsImportBatch::getRaw

File

./OAuth2HTTPSFetcher.inc, line 31

Class

OAuth2HTTPSBatch
Definition of the import batch object created on the fetching stage by OAuth2HTTPSFetcher.

Code

public function getRaw() {
  require_once drupal_get_path('module', 'feeds_oauth') . '/php-proauth-read-only/lib/oauth/OAuth2Client.php';
  $access_token = call_user_func($this->authenticator, $this->uid, $this->site_id);
  $oauth = new OAuth2CurlClient();
  $oauth
    ->_setAccessToken(new OAuth2AccessToken($access_token['oauth_token']));
  $request = $oauth
    ->createGetRequest($this->url, array(
    'access_token' => $oauth
      ->getAccessToken()
      ->getToken(),
  ));
  $response = $oauth
    ->executeRequest($request);
  if ($response
    ->getStatusCode() == 200) {
    return $response
      ->getBody();
  }
  else {
    watchdog('feeds_oauth', print_r($response
      ->getBody(), TRUE), array());
  }
}