private function getOAuthHeader($location, $request) { try { $oauth = new OAuthSimple($this->getAccountId(), $this->getSharedKey()); $oauth->setAction("POST"); $oauth->genBodyHash($request); $parse = parse_url($location); $port = (isset($parse["port"]) and ($parse["port"] == '80' or $parse["port"] == '443')) ? '' : !isset($parse["port"]) ? '' : ':' . $parse["port"]; if (!is_null($this->language)) { $oauth->setParameters(array('lang' => $this->language)); } $oauth->setPath($parse["scheme"] . '://' . $parse["host"] . $port . $parse["path"]); $header_string = $oauth->getHeaderString(); $oauth->reset(); } catch (Exception $e) { throw new TurnitinSDKException('oautherror', $e->getMessage(), $this->getLogPath()); } return $header_string; }