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


PHP Varien_Http_Adapter_Curl::getInfo方法代码示例

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


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

示例1: ping

 /**
  * Call the /admin/ping servlet, can be used to quickly tell if a connection to the server is able to be made
  *
  * @param float $timeout maximum time to wait for ping in seconds, -1 for unlimited (default is 2)
  *
  * @return float|bool
  */
 public function ping($timeout = 0)
 {
     $this->_setBasicAdapterOptions($timeout);
     $this->_curlAdapter->addOptions(array(CURLOPT_HEADER => 0, CURLOPT_NOBODY => 1))->write(Zend_Http_Client::GET, $this->_pingUrl);
     $totalTime = microtime(1);
     $this->_curlAdapter->read();
     $result = $this->_curlAdapter->getInfo(CURLINFO_HTTP_CODE) == 200 ? round(microtime(1) - $totalTime, 3) : false;
     $this->_curlAdapter->close();
     return $result;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:17,代码来源:Solr.php

示例2: _makeRequest

 protected function _makeRequest($ping)
 {
     $curl = new Varien_Http_Adapter_Curl();
     $curl->setConfig(array('timeout' => 20));
     $curl->write(Zend_Http_Client::GET, $ping, '1.1');
     $data = $curl->read();
     if ($data === false) {
         return false;
     }
     $code = $curl->getInfo(CURLINFO_HTTP_CODE);
     if ($code == 200) {
         return $code;
     } else {
         Mage::log("Submission to: " . $ping . " failed, HTTP response code was not 200");
         Mage::log("Response error: " . $data);
         // uncomment to debug raw submission response
         return false;
     }
     //TODO: handle timeout?
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:20,代码来源:Pings.php

示例3: sendBroadcastMessage

 /**
  * Send broadcast message
  *
  * @throws Mage_Core_Exception
  * @param Mage_XmlConnect_Model_Queue $queue
  */
 public function sendBroadcastMessage(Mage_XmlConnect_Model_Queue $queue)
 {
     if ($queue->getStatus() != Mage_XmlConnect_Model_Queue::STATUS_IN_QUEUE) {
         return;
     }
     try {
         $applicationId = Mage::getModel('xmlconnect/template')->load($queue->getTemplateId())->getApplicationId();
         /** @var $app Mage_XmlConnect_Model_Application */
         $app = Mage::getModel('xmlconnect/application')->load($applicationId);
         if (!$app->getId()) {
             Mage::throwException(Mage::helper('xmlconnect')->__('Can\'t load application with id "%s"', $applicationId));
         }
         if (!$app->isNotificationsActive()) {
             $queue->setStatus(Mage_XmlConnect_Model_Queue::STATUS_CANCELED);
             return;
         }
         $sendType = $queue->getData('type');
         switch ($sendType) {
             case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL:
                 $configPath = 'xmlconnect/' . Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_AIRMAIL . '/broadcast_url';
                 $params = $queue->getAirmailBroadcastParams();
                 break;
             case Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_PUSH:
             default:
                 $configPath = 'xmlconnect/' . Mage_XmlConnect_Model_Queue::MESSAGE_TYPE_PUSH . '/broadcast_url';
                 $params = $queue->getPushBroadcastParams();
                 break;
         }
         $curl = new Varien_Http_Adapter_Curl();
         $curl->setConfig($this->_getCurlConfig($app->getUserpwd()));
         $urbanUrl = Mage::getStoreConfig($configPath);
         $curl->write(Zend_Http_Client::POST, $urbanUrl, HTTP_REQUEST_HTTP_VER_1_1, $this->getHttpHeaders(), $params);
         if ($curl->read() && $curl->getInfo(CURLINFO_HTTP_CODE) == 200) {
             $queue->setStatus(Mage_XmlConnect_Model_Queue::STATUS_COMPLETED);
         }
         $curl->close();
         $queue->setIsSent(true);
         $queue->save();
         return;
     } catch (Exception $e) {
         Mage::logException($e);
         throw $e;
     }
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:50,代码来源:Data.php

示例4: isReadablePopupObject

 /**
  * Check is readable Popup Notification Object
  * @deprecated after 1.4.2.0
  *
  * @return bool
  */
 public function isReadablePopupObject()
 {
     if (is_null($this->_popupReadable)) {
         $this->_popupReadable = false;
         $curl = new Varien_Http_Adapter_Curl();
         $curl->setConfig(array('timeout' => 2));
         $curl->write(Zend_Http_Client::GET, $this->getPopupObjectUrl(true));
         if ($curl->read()) {
             if ($curl->getInfo(CURLINFO_HTTP_CODE) == 200) {
                 $this->_popupReadable = true;
             }
         }
     }
     return $this->_popupReadable;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:21,代码来源:Data.php

示例5: initialize

 /**
  *
  * @param mixed                    $apiCallResult
  * @param Varien_Http_Adapter_Curl $apiService
  */
 public function initialize($apiCallResult, Varien_Http_Adapter_Curl $apiService)
 {
     $this->_result = $apiCallResult;
     $this->_error = $apiService->getError();
     $this->_httpStatus = $apiService->getInfo(CURLINFO_HTTP_CODE);
 }
开发者ID:Keesromkes,项目名称:magentoStylaConnect,代码行数:11,代码来源:Abstract.php


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