You are here

protected function DrupalOAuthClient::interpretResponse in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 includes/DrupalOAuthClient.inc \DrupalOAuthClient::interpretResponse()
  2. 7.3 includes/DrupalOAuthClient.inc \DrupalOAuthClient::interpretResponse()
1 call to DrupalOAuthClient::interpretResponse()
DrupalOAuthClient::get in includes/DrupalOAuthClient.inc
Make an OAuth request.

File

includes/DrupalOAuthClient.inc, line 376

Class

DrupalOAuthClient

Code

protected function interpretResponse($res) {
  list($headers, $body) = preg_split('/\\r\\n\\r\\n/', $res, 2);
  $obj = (object) array(
    'headers' => $headers,
    'body' => $body,
  );
  $matches = array();
  if (preg_match('/HTTP\\/1.\\d (\\d{3}) (.*)/', $headers, $matches)) {
    $obj->responseCode = trim($matches[1]);
    $obj->responseMessage = trim($matches[2]);

    // Handle HTTP/1.1 100 Continue
    if ($obj->responseCode == 100) {
      return $this
        ->interpretResponse($body);
    }
  }
  return $obj;
}