当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Http_Response类代码示例

本文整理汇总了PHP中Zend_Http_Response的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Http_Response类的具体用法?PHP Zend_Http_Response怎么用?PHP Zend_Http_Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Http_Response类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseZendResponse

 /**
  * @param Zend_Http_Response $response
  * @return json string
  * @throws
  */
 public function parseZendResponse(Zend_Http_Response $response)
 {
     if ($response->getStatus() == 200) {
         return $response->getBody();
     } else {
         throw new Exception("Error: Status is: " . $response->getStatus() . " message: " . $response->getMessage());
     }
 }
开发者ID:rwadegaonkar,项目名称:hobbyhorse,代码行数:13,代码来源:Wrapper.php

示例2: formatResponse

 /** Set up the response rendering
  * 
  * @param string $response
  */
 public function formatResponse(Zend_Http_Response $response)
 {
     if ('json' === $this->getResponseType()) {
         return json_decode($response->getBody());
     } else {
         return new Zend_Rest_Client_Result($response->getBody());
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:12,代码来源:Place.php

示例3: task

 public function task(Zend_Http_Response $response, Zend_Http_Client $client)
 {
     $query = new Zend_Dom_Query($response->getBody());
     $images = $query->query('img');
     foreach ($images as $image) {
         $this->images[] = $image->getAttribute('src');
     }
     $this->images = array_unique($this->images);
 }
开发者ID:austinphp,项目名称:crawler,代码行数:9,代码来源:FindImagesTask.php

示例4: __construct

 /**
  *
  *
  * @param Zend_Http_Response $response JSON response from the PinPayments gateway
  * @throws Dwyera_Pinpay_Model_ResponseParseException If an invalid JSON response object is passed
  */
 public function __construct(Zend_Http_Response $response)
 {
     $this->response = $response;
     $this->httpResponseCode = $response->getStatus();
     $this->msgObj = json_decode($response->getBody());
     if ($this->msgObj == null) {
         throw new Dwyera_Pinpay_Model_ResponseParseException("Could not parse PinPayments gateway response");
     }
 }
开发者ID:andrew-dwyer,项目名称:PINpayments,代码行数:15,代码来源:Result.php

示例5: _parseResponse

 /**
  * Retrieve latitude and longitude from the API response
  *
  * @param Zend_Http_Response|boolean $response
  * @return array|boolean
  */
 protected function _parseResponse($response)
 {
     if ($response->isSuccessful() && $response->getStatus() == 200) {
         $_response = json_decode($response->getBody());
         $_coordinates = $_response->results[0]->geometry->location;
         $geo = array('lat' => $_coordinates->lat, 'lng' => $_coordinates->lng);
         return $geo;
     }
     return false;
 }
开发者ID:kalburgimanjunath,项目名称:magento-dealers,代码行数:16,代码来源:Google.php

示例6: processInputData

 /**
  * (non-PHPdoc)
  * @see Tid_Rest_Processor_Input_Abstract::processInputData()
  */
 public function processInputData(Zend_Http_Response $response = null)
 {
     try {
         return isset($response) ? Zend_Json::decode($response->getBody()) : array();
     } catch (Exception $e) {
         $this->getRestService()->log("Error parsing JSON response: " . $e->getMessage(), Zend_Log::ERR);
         $this->getRestService()->log($e, Zend_Log::ERR);
         throw new App_Rest_Processor_Input_Exception('Error response: [code] ' . $response->getStatus() . ' [error] ' . $response->getMessage());
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:14,代码来源:Json.php

示例7: __construct

 /**
  * base constructor for Response objects
  *
  * @param Zend_Http_Response $response
  */
 public function __construct($response)
 {
     if ($response instanceof Zend_Http_Response) {
         $this->_response = WirecardCEE_Stdlib_SerialApi::decode($response->getBody());
     } elseif (is_array($response)) {
         $this->_response = $response;
     } else {
         throw new WirecardCEE_Stdlib_Exception_InvalidResponseException(sprintf('Invalid response from WirecardCEE thrown in %s.', __METHOD__));
     }
 }
开发者ID:wirecard,项目名称:magento-wcs,代码行数:15,代码来源:ResponseAbstract.php

示例8: __construct

 /**
  * Constructeur
  *
  * Affecte la réponse HTTP à une propriété, ainsi que le body.
  * Il tente ensuite de déchiffrer le corps en tant que JSON.
  *
  * @param  Zend_Http_Response $httpResponse
  * @throws SDIS62_Service_Generic_Exception
  */
 public function __construct(Zend_Http_Response $httpResponse)
 {
     $this->httpResponse = $httpResponse;
     $this->rawBody = $httpResponse->getBody();
     try {
         $jsonBody = Zend_Json::decode($this->rawBody, Zend_Json::TYPE_OBJECT);
         $this->jsonBody = $jsonBody;
     } catch (Zend_Json_Exception $e) {
         throw new SDIS62_Service_Generic_Exception('impossible de décoder la réponse: ' . $e->getMessage(), 0, $e);
     }
 }
开发者ID:sdis62,项目名称:toolbox,代码行数:20,代码来源:Response.php

示例9: __construct

 public function __construct(Zend_Http_Response $response)
 {
     $body = $response->getRawBody();
     $json = Zend_Json::decode($body);
     $this->_id = $json['id'];
     if (null !== $json['error']) {
         $this->_error = $json['error'];
     } else {
         $this->_result = $json['result'];
     }
 }
开发者ID:jtietema,项目名称:Fizzy,代码行数:11,代码来源:Response.php

示例10: load

 public function load(\Zend_Http_Response $httpResponse)
 {
     $this->_reset();
     if ($httpResponse->getBody()) {
         set_error_handler(array($this, 'handleLoadErrors'));
         $this->_simpleXml = simplexml_load_string($httpResponse->getBody());
         restore_error_handler();
     }
     $this->_httpResponse = $httpResponse;
     return $this;
 }
开发者ID:sirprize,项目名称:rest,代码行数:11,代码来源:SimpleXml.php

示例11: load

 public function load(\Zend_Http_Response $httpResponse)
 {
     $this->_reset();
     if ($httpResponse->getBody()) {
         set_error_handler(array($this, 'handleLoadErrors'));
         $this->_json = json_decode($httpResponse->getBody());
         restore_error_handler();
     }
     $this->_httpResponse = $httpResponse;
     return $this;
 }
开发者ID:sirprize,项目名称:rest,代码行数:11,代码来源:Json.php

示例12: _decodeResponse

 /**
  * Decode request response
  *
  * @param Zend_Http_Response $response response of request
  * @throws Zend_Db_Exception
  * @return array
  */
 protected function _decodeResponse(Zend_Http_Response $response)
 {
     $result = Zend_Json::decode($response->getBody());
     if (is_null($result)) {
         throw new Zend_Db_Exception($response->getMessage());
     }
     if ($result["error"]) {
         throw new Exception($result["reason"], $this->_errors[$result["error"]]);
     }
     return $result;
 }
开发者ID:BGCX261,项目名称:zrails-svn-to-git,代码行数:18,代码来源:Couchdb.php

示例13: __construct

 /**
  * base ctor for Response objects
  * @param Zend_Http_Response $response
  */
 public function __construct($response)
 {
     if ($response instanceof Zend_Http_Response) {
         $this->_response = WirecardCEE_SerialApi::decode($response->getBody());
     } else {
         if (is_array($response)) {
             $this->_response = $response;
         } else {
             throw new WirecardCEE_Exception('Invalid response from WirecardCEE');
         }
     }
 }
开发者ID:netzkollektiv,项目名称:wirecard-checkout-magento,代码行数:16,代码来源:Abstract.php

示例14: load

 public function load(\Zend_Http_Response $httpResponse)
 {
     $this->_reset();
     if ($httpResponse->getBody()) {
         set_error_handler(array($this, 'handleLoadErrors'));
         $this->_dom = new \DOMDocument();
         $this->_dom->loadXml($httpResponse->getBody());
         restore_error_handler();
     }
     $this->_httpResponse = $httpResponse;
     return $this;
 }
开发者ID:sirprize,项目名称:rest,代码行数:12,代码来源:Dom.php

示例15: processResponse

 public function processResponse(Zend_Http_Response $response)
 {
     $serviceName = $this->getRestService()->getServiceName();
     if (!$serviceName) {
         throw new \Application\Exceptions\UnexpectedException("Service Name doesn't exist");
     }
     $this->checkAlarmTimeSpent($serviceName);
     if ($response->isSuccessful()) {
         App::alarm()->notifyInvalidHttpCode($serviceName);
     } else {
         App::alarm()->notifyInvalidHttpCode($serviceName, $response->getStatus());
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:13,代码来源:Alarm.php


注:本文中的Zend_Http_Response类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。