當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。