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


PHP Zend_Http_Response::isSuccessful方法代码示例

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


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

示例1: wasSuccess

 /**
  * Determines if the last request was a success (1** - 2** code).
  * 
  * @return boolean
  */
 protected function wasSuccess()
 {
     if (!isset($this->lastResponse)) {
         $this->handleError("Request has not been sent to the API");
         return false;
     }
     return $this->lastResponse->isSuccessful();
 }
开发者ID:recensus,项目名称:php-sdk,代码行数:13,代码来源:Api.php

示例2: _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

示例3: 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

示例4: _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());
         if (is_array($_response->postalcodes)) {
             $_response = array_shift($_response->postalcodes);
         }
         if ($_response) {
             $geo = array('lat' => $_response->lat, 'lng' => $_response->lng);
         } else {
             $geo = false;
         }
         return $geo;
     }
     return false;
 }
开发者ID:kalburgimanjunath,项目名称:magento-dealers,代码行数:22,代码来源:Geonames.php

示例5: parseRawResponse

 /**
  * Extract the API response data from the given HTTP response object.
  *
  * @param Zend_Http_Response $response
  *
  * @return $this
  */
 protected function parseRawResponse(Zend_Http_Response $response)
 {
     if ($response->isSuccessful()) {
         $content = $response->getBody();
         if (strlen($content) > 0) {
             try {
                 $xml = simplexml_load_string($response->getBody());
             } catch (Exception $e) {
                 // Failed to parse XML
                 $this->successful = false;
                 $this->setMessage("Failed to parse a response from Klevu.");
                 Mage::helper('klevu_search')->log(Zend_Log::ERR, sprintf("Failed to parse XML response: %s", $e->getMessage()));
                 return $this;
             }
             $this->xml = $xml;
             $this->successful = true;
         } else {
             // Response contains no content
             $this->successful = false;
             $this->setMessage('Failed to parse a response from Klevu.');
             Mage::helper('klevu_search')->log(Zend_Log::ERR, "API response content is empty.");
         }
     } else {
         // Unsuccessful HTTP response
         $this->successful = false;
         switch ($response->getStatus()) {
             case 403:
                 $message = "Incorrect API keys.";
                 break;
             case 500:
                 $message = "API server error.";
                 break;
             case 503:
                 $message = "API server unavailable.";
                 break;
             default:
                 $message = "Unexpected error.";
         }
         $this->setMessage(sprintf("Failed to connect to Klevu: %s", $message));
         Mage::helper('klevu_search')->log(Zend_Log::ERR, sprintf("Unsuccessful HTTP response: %s %s", $response->getStatus(), $response->responseCodeAsText($response->getStatus())));
     }
     return $this;
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:50,代码来源:Response.php

示例6: isError

 /**
  * Did an error occur in the request?
  *
  * @return bool
  */
 public function isError()
 {
     return !$this->httpResponse->isSuccessful();
 }
开发者ID:vrtulka23,项目名称:daiquiri,代码行数:9,代码来源:Response.php

示例7: parseResponse

 /**
  * Throw an exception if error occured
  *
  * @param SimpleXMLElement $xml
  * @return SimpleXMLElement
  */
 private function parseResponse(\Zend_Http_Response $response)
 {
     if (!$response->isSuccessful()) {
         throw new \RuntimeException("Response not successful.");
     }
     $xml = simplexml_load_string($response->getBody());
     if ($xml->getName() !== 'newsMessage' && !in_array((int) $xml->status['code'], array(self::STATUS_SUCCESS, self::STATUS_PARTIAL_SUCCESS))) {
         throw new \RuntimeException((string) $xml->status->error);
     }
     return $xml;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:17,代码来源:ReutersFeed.php

示例8: _getHandlerKey

 /**
  * return a string that is a key to the handler config for the class of status codes.
  * @param  Zend_Http_Response $response
  * @return string
  */
 protected function _getHandlerKey(Zend_Http_Response $response = null)
 {
     if ($response) {
         $code = $response->getStatus();
         if ($response->isSuccessful() || $response->isRedirect()) {
             return 'success';
         } elseif ($code < 500 && $code >= 400) {
             return 'client_error';
         } elseif ($code >= 500) {
             return 'server_error';
         }
         // @codeCoverageIgnoreStart
     }
     // @codeCoverageIgnoreEnd
     return 'no_response';
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:21,代码来源:Api.php


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