コード例 #1
0
 /**
  * Sends a request and returns a response
  *
  * @param CartRecover_Request $request
  * @return Cart_Recover_Response
  */
 public function sendRequest(CartRecover_Request $request)
 {
     $this->client->setUri($request->getUri());
     $this->client->setParameterGet($request->getParams());
     $this->client->setMethod($request->getMethod());
     $this->client->setHeaders(array('Accept' => 'application/json'));
     $this->response = $this->client->send();
     if ($this->response->getHeaders()->get('Content-Type')->getFieldValue() != 'application/json') {
         throw new CartRecover_Exception_UnexpectedValueException("Unknown response format.");
     }
     $body = json_decode($this->response->getContent(), true);
     $response = new CartRecover_Response();
     $response->setRawResponse($this->response->toString());
     $response->setBody($body);
     $response->setHeaders($this->response->getHeaders()->toArray());
     $response->setStatus($this->response->getReasonPhrase(), $this->response->getStatusCode());
     return $response;
 }
コード例 #2
0
ファイル: AbstractGoGrid.php プロジェクト: navassouza/zf2
 /**
  * Get the last error type
  * 
  * @return integer
  */
 public function getHttpStatus()
 {
     return $this->_lastResponse->getStatusCode();
 }