You are here

private function OAuthRequest::getRequestBody in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/OAuthRequest.php \OAuthRequest::getRequestBody()

* Get the body of a POST or PUT. * * Used for fetching the post parameters and to calculate the body signature. * *

Return value

string null when no body present (or wrong content type for body)

1 call to OAuthRequest::getRequestBody()
OAuthRequest::__construct in lib/oauth-php/library/OAuthRequest.php
* Construct from the current request. Useful for checking the signature of a request. * When not supplied with any parameters this will use the current request. * *

File

lib/oauth-php/library/OAuthRequest.php, line 744

Class

OAuthRequest
Object to parse an incoming OAuth request or prepare an outgoing OAuth request

Code

private function getRequestBody() {
  $body = null;
  if ($this->method == 'POST' || $this->method == 'PUT') {
    $body = '';
    $fh = @fopen('php://input', 'r');
    if ($fh) {
      while (!feof($fh)) {
        $s = fread($fh, 1024);
        if (is_string($s)) {
          $body .= $s;
        }
      }
      fclose($fh);
    }
  }
  return $body;
}