You are here

private function LingotekOAuthRequest::getRequestBody in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::getRequestBody()
  2. 7.5 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::getRequestBody()
  3. 7.6 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::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 LingotekOAuthRequest::getRequestBody()
LingotekOAuthRequest::__construct in lib/oauth-php/library/LingotekOAuthRequest.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/LingotekOAuthRequest.php, line 660

Class

LingotekOAuthRequest
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;
}