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