/** * Creates a new HTTP POST request with the appropriate content, headers * and such, which can then be used to send JSON-RPC requests. * @param string $content the request content * @return \Zend\Http\Request the request * @throws ClientException if the Content-Type header cannot be set */ private function createHttpRequest($content) { $httpRequest = new \Zend\Http\Request(); $httpRequest->setUri($this->_endPoint); $httpRequest->setMethod(\Zend\Http\Request::METHOD_POST); $httpRequest->setContent($content); // Set headers $headers = $httpRequest->getHeaders(); if (!$headers instanceof \Zend\Http\Headers) { throw new ClientException('Unable to configure HTTP headers'); } $headers->addHeaderLine('Content-Type', 'application/json'); $httpRequest->setHeaders($headers); return $httpRequest; }