You are here

private function TwitterAPIExchange::buildAuthorizationHeader in Heartbeat 8

Private method to generate authorization header used by cURL

Parameters

array $oauth Array of oauth data generated by buildOauth():

Return value

string $return Header used by cURL for request

1 call to TwitterAPIExchange::buildAuthorizationHeader()
TwitterAPIExchange::performRequest in modules/statusmessage/includes/TwitterAPIExchange.php
Perform the actual data retrieval from the API

File

modules/statusmessage/includes/TwitterAPIExchange.php, line 358

Class

TwitterAPIExchange
Twitter-API-PHP : Simple PHP wrapper for the v1.1 API

Code

private function buildAuthorizationHeader(array $oauth) {
  $return = 'Authorization: OAuth ';
  $values = array();
  foreach ($oauth as $key => $value) {
    if (in_array($key, array(
      'oauth_consumer_key',
      'oauth_nonce',
      'oauth_signature',
      'oauth_signature_method',
      'oauth_timestamp',
      'oauth_token',
      'oauth_version',
    ))) {
      $values[] = "{$key}=\"" . rawurlencode($value) . "\"";
    }
  }
  $return .= implode(', ', $values);
  return $return;
}