• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Http_Client类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * 決済開始
  * @args $args['cardnumber'] ハイフンなしのカード番号
  * @args $args['expyy']  年(2桁)
  * @args $args['expmm']  月(2桁)
  * @args $args['telno']  ハイフンなしの電話番号
  * @args $args['email']  メールアドレス
  * @args $args['sendid'] 注文ID
  * @args $args['username'] スペースなしのユーザー名(英字)
  * @args $args['money']  決済金額(総額)
  * @args $args['div']    分割数(01/03/05/06/10)
  */
 public static function execute($args)
 {
     $config = Zend_Registry::get('config');
     $params['clientip'] = $config->zeus->clientip;
     $params['cardnumber'] = $args['cardnumber'];
     $params['expyy'] = $args['expyy'];
     $params['expmm'] = $args['expmm'];
     $params['telno'] = $args['telno'];
     $params['email'] = $args['email'];
     $params['sendid'] = $args['sendid'];
     $params['username'] = $args['username'];
     $params['money'] = $args['money'];
     $params['sendpoint'] = 'eccube';
     $params['send'] = 'mall';
     $params['pubsec'] = '';
     $params['div'] = $args['div'];
     // 0円のときは決済しない
     if (!$args['money']) {
         return false;
     }
     // 決済開始
     $client = new Zend_Http_Client($config->zeus->api_url);
     $client->setParameterPost($params);
     $response = $client->request('POST');
     // 結果の判定
     if ($response->getBody() === 'Success_order') {
         return true;
     } else {
         return false;
     }
 }
开发者ID:herisher,项目名称:citrajayamandiri,代码行数:43,代码来源:Zeus.php


示例2: icsAction

 public function icsAction()
 {
     $this->api_user = Mage::getModel('core/variable')->setStoreId(Mage::app()->getStore()->getId())->loadByCode('pmt_api_user')->getValue('text');
     $this->api_password = Mage::getModel('core/variable')->setStoreId(Mage::app()->getStore()->getId())->loadByCode('pmt_api_password')->getValue('text');
     // get prescription id
     $prescriptionRepeatId = Mage::app()->getRequest()->getParam('id');
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     $client = new Zend_Http_Client($this->api_get_prescripton_url . $prescriptionRepeatId);
     $params = ['pmt_user_id' => $customer->getId(), 'prescription_repeat_id' => $prescriptionRepeatId];
     // set some parameters
     $client->setParameterPost($params);
     $client->setAuth($this->api_user, $this->api_password, \Zend_Http_Client::AUTH_BASIC);
     // POST request
     $result = $client->request(Zend_Http_Client::POST);
     // decode response
     $jsonData = json_decode($result->getBody());
     //		var_dump($prescriptionRepeatId . $customer->getId());
     //		var_dump($result);
     //		exit();
     if (!$jsonData->status == 'success') {
         // create error message, before redirecting
         // redirect to prescriptions page
         $this->redirectDashboard();
     }
     $this->loadLayout();
     $block = $this->getLayout()->getBlock('prescriptions_ics');
     $block->assign(['repeat' => $jsonData->data->repeats[0], 'product' => $jsonData->data->prescription]);
     $this->renderLayout();
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:29,代码来源:IndexController.php


示例3: studentAction

 /**
  * The default action - show the home page
  */
 public function studentAction()
 {
     $this->_helper->viewRenderer->setNoRender(false);
     $request = $this->getRequest();
     $department = $request->getParam('department_id');
     $degree = $request->getParam('degree_id');
     $batch = $request->getParam('batch');
     if (isset($degree) and isset($department) and isset($batch)) {
         $client = new Zend_Http_Client('http://' . CORE_SERVER . '/batch/getbatchstudent' . "?department_id={$department}" . "&degree_id={$degree}" . "&batch_id={$batch}");
         $client->setCookie('PHPSESSID', $_COOKIE['PHPSESSID']);
         $response = $client->request();
         if ($response->isError()) {
             $remoteErr = 'REMOTE ERROR: (' . $response->getStatus() . ') ' . $response->getHeader('Message');
             throw new Zend_Exception($remoteErr, Zend_Log::ERR);
         } else {
             $jsonContent = $response->getBody($response);
             $students = Zend_Json::decode($jsonContent);
             $this->_helper->logger($jsonContent);
             $this->view->assign('students', $students);
             $this->view->assign('department', $department);
             $this->view->assign('degree', $degree);
             $this->view->assign('batch', $batch);
         }
     }
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:28,代码来源:BarcodeController.php


示例4: collectRates

 /**
  * @param Mage_Shipping_Model_Rate_Request $request
  * @return Mage_Shipping_Model_Rate_Result
  */
 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 {
     /** @var Mage_Shipping_Model_Rate_Result $result */
     $result = Mage::getModel('shipping/rate_result');
     $totalWeight = 0;
     foreach ($request->getAllItems() as $item) {
         $totalWeight += $item->getWeight() * $item->getQty();
     }
     /** @var string $hostname */
     $hostname = $this->getConfigData('hostname');
     /** @var string $port */
     $port = $this->getConfigData('port');
     try {
         $client = new Zend_Http_Client();
         $response = $client->setUri("http://{$hostname}:{$port}/")->setRawData(json_encode(['totalWeight' => $totalWeight]))->setEncType('application/json')->request('POST');
         switch ($response->getStatus()) {
             case 200:
                 $responseBody = json_decode($response->getBody());
                 $result->append($this->_getShippingMethod($responseBody->rate));
                 break;
             case 500:
                 // Handle 500 Error
                 break;
             default:
         }
     } catch (Exception $e) {
         var_dump($e);
     }
     return $result;
 }
开发者ID:sraleci,项目名称:ba-shipping-method,代码行数:34,代码来源:Carrier.php


示例5: validate

 public function validate($username, $password)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Options: ' . print_r($this->_options, true));
     }
     $url = isset($this->_options['url']) ? $this->_options['url'] : 'https://localhost/validate/check';
     $adapter = new Zend_Http_Client_Adapter_Socket();
     $adapter->setStreamContext($this->_options = array('ssl' => array('verify_peer' => isset($this->_options['ignorePeerName']) ? false : true, 'allow_self_signed' => isset($this->_options['allowSelfSigned']) ? true : false)));
     $client = new Zend_Http_Client($url, array('maxredirects' => 0, 'timeout' => 30));
     $client->setAdapter($adapter);
     $params = array('user' => $username, 'pass' => $password);
     $client->setParameterPost($params);
     try {
         $response = $client->request(Zend_Http_Client::POST);
     } catch (Zend_Http_Client_Adapter_Exception $zhcae) {
         Tinebase_Exception::log($zhcae);
         return Tinebase_Auth::FAILURE;
     }
     $body = $response->getBody();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Request: ' . $client->getLastRequest());
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Response: ' . $body);
     }
     if ($response->getStatus() !== 200) {
         return Tinebase_Auth::FAILURE;
     }
     $result = Tinebase_Helper::jsonDecode($body);
     if (isset($result['result']) && $result['result']['status'] === true && $result['result']['value'] === true) {
         return Tinebase_Auth::SUCCESS;
     } else {
         return Tinebase_Auth::FAILURE;
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:35,代码来源:PrivacyIdea.php


示例6: responseAction

 public function responseAction()
 {
     // Get User Configuration
     $epayphId = Mage::getStoreConfig('payment/epayphPaymentModule/epayphId');
     $apiKey = Mage::getStoreConfig('payment/epayphPaymentModule/epayphApiKey');
     $apiSecret = Mage::getStoreConfig('payment/epayphPaymentModule/epayphApiSecret');
     $url = 'https://epay.ph/api/validateIPN';
     $json = json_encode($_POST);
     $client = new Zend_Http_Client($url);
     $client->setHeaders(array('Accept: application/json'));
     $_POST['cmd'] = '_notify-validate';
     $client->setParameterPost($_POST);
     $request = $client->request('POST');
     if ($request->getBody() == '{"return":"VERIFIED"}') {
         $order = Mage::getModel('sales/order');
         $order->loadByIncrementId($_POST['invoice']);
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, "Epay.ph Gateway informed us: the payment's Transaction ID is {$_POST['txn_id']}");
         $order->sendNewOrderEmail();
         $order->setEmailSent(true);
         $order->save();
         Mage::getSingleton('checkout/session')->unsQuoteId();
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
     } else {
         $this->cancelAction(FALSE, 'Epay.ph signature did not validate');
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
     }
 }
开发者ID:Neuralink,项目名称:epayph_magento,代码行数:27,代码来源:PaymentController.php


示例7: getPluginList

 protected function getPluginList()
 {
     $list = array();
     $config = null;
     if ($proxy = parse_url(sfConfig::get('op_http_proxy'))) {
         $config = array('adapter' => 'Zend_Http_Client_Adapter_Proxy');
         if (isset($proxy['host'])) {
             $config['proxy_host'] = $proxy['host'];
         }
         if (isset($proxy['port'])) {
             $config['proxy_port'] = $proxy['port'];
         }
         if (isset($proxy['user'])) {
             $config['proxy_user'] = $proxy['user'];
         }
         if (isset($proxy['pass'])) {
             $config['proxy_pass'] = $proxy['pass'];
         }
     }
     try {
         $client = new Zend_Http_Client('http://' . opPluginManager::OPENPNE_PLUGIN_CHANNEL . '/packages/' . OPENPNE_VERSION . '.yml', $config);
         $response = $client->request();
         if ($response->isSuccessful()) {
             $list = sfYaml::load($response->getBody());
             $list = $this->applyLocalPluginList($list);
         } else {
             $str = "Failed to download plugin list.";
             $this->logBlock($str, 'ERROR');
         }
     } catch (Zend_Http_Client_Adapter_Exception $e) {
         $str = "Failed to download plugins list.";
         $this->logBlock($str, 'ERROR');
     }
     return $list;
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:35,代码来源:opPluginSyncTask.class.php


示例8: validate

 /**
  * Validate the license information
  *
  * @param string $userId
  * @param array $spMetadata
  * @param array $idpMetadata
  * @return string
  */
 public function validate($userId, array $spMetadata, array $idpMetadata)
 {
     if (!$this->_active) {
         return EngineBlock_LicenseEngine_ValidationManager::LICENSE_UNKNOWN;
     }
     $client = new Zend_Http_Client($this->_url);
     $client->setConfig(array('timeout' => 15));
     try {
         $client->setHeaders(Zend_Http_Client::CONTENT_TYPE, 'application/json; charset=utf-8')->setParameterGet('userId', urlencode($userId))->setParameterGet('serviceProviderEntityId', urlencode($spMetadata['EntityId']))->setParameterGet('identityProviderEntityId', urlencode($idpMetadata['EntityId']))->request('GET');
         $body = $client->getLastResponse()->getBody();
         $response = json_decode($body, true);
         $status = $response['status'];
     } catch (Exception $exception) {
         $additionalInfo = new EngineBlock_Log_Message_AdditionalInfo($userId, $idpMetadata['EntityId'], $spMetadata['EntityId'], $exception->getTraceAsString());
         EngineBlock_ApplicationSingleton::getLog()->error("Could not connect to License Manager" . $exception->getMessage(), $additionalInfo);
         return EngineBlock_LicenseEngine_ValidationManager::LICENSE_UNKNOWN;
     }
     if ($status['returnUrl']) {
         $currentResponse = EngineBlock_ApplicationSingleton::getInstance()->getHttpResponse();
         $currentResponse->setRedirectUrl($status['returnUrl']);
         $currentResponse->send();
         exit;
     } else {
         if ($status['licenseStatus']) {
             return $status['licenseStatus'];
         } else {
             return EngineBlock_LicenseEngine_ValidationManager::LICENSE_UNKNOWN;
         }
     }
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:38,代码来源:ValidationManager.php


示例9: logoutAction

 public function logoutAction()
 {
     $serverUrl = 'http://' . AUTH_SERVER . self::AUTH_PATH . '/logout';
     $client = new Zend_Http_Client($serverUrl, array('timeout' => 30));
     try {
         if (isset($_COOKIE[self::AUTH_SID])) {
             $moduleName = $this->getRequest()->getModuleName();
             $client->setCookie('PHPSESSID', $_COOKIE[self::AUTH_SID]);
             $client->setCookie('moduleName', $moduleName);
             $response = $client->request();
             if ($response->isError()) {
                 $remoteErr = $response->getStatus() . ' : ' . $response->getMessage() . '<br/>' . $response->getBody();
                 throw new Zend_Exception($remoteErr, Zend_Log::ERR);
             }
         } else {
             $this->_helper->logger('No remote cookie found');
         }
     } catch (Zend_Exception $e) {
         echo $e->getMessage();
     }
     if (isset($_COOKIE[self::AUTH_SID])) {
         preg_match('/[^.]+\\.[^.]+$/', $_SERVER['SERVER_NAME'], $domain);
         setcookie(self::AUTH_SID, '', time() - 360000, self::AUTH_PATH, ".{$domain['0']}");
     }
     Zend_Auth::getInstance()->clearIdentity();
     Zend_Session::destroy();
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:27,代码来源:AuthenticateController.php


示例10: getContent

 /**
  * returns the content of this item
  *
  * @return string content
  */
 public function getContent()
 {
     if ($this->items !== false && $this->valid()) {
         try {
             // load entry page
             $client = new Zend_Http_Client($this->getLink() . '?page=all');
             $response = $client->request();
             $content = $response->getBody();
             $content = utf8_decode($content);
             // parse content
             $dom = new Zend_Dom_Query($content);
             $text = $dom->query('.article');
             $innerHTML = '';
             // convert innerHTML from DOM to string
             // taken from http://us2.php.net/domelement (patrick smith)
             $children = $text->current()->childNodes;
             foreach ($children as $child) {
                 $tmp_doc = new DOMDocument();
                 $tmp_doc->appendChild($tmp_doc->importNode($child, true));
                 if (count($tmp_doc->getElementById('comments')) > 0) {
                     continue;
                 }
                 // convert to text
                 $innerHTML .= @$tmp_doc->saveHTML();
             }
             return $innerHTML;
         } catch (Exception $e) {
             // return default content
             return current($this->items)->get_content();
         }
     }
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:37,代码来源:zeit.php


示例11: _request

 /**
  * 
  */
 protected function _request($url, $params, $method = Zend_Http_Client::GET)
 {
     $this->_client->setUri($url)->resetParameters();
     if (count($params['header'])) {
         foreach ($params['header'] as $name => $value) {
             $this->_client->setHeaders($name, $value);
         }
     }
     if (count($params['post'])) {
         foreach ($params['post'] as $name => $value) {
             $this->_client->setParameterPost($name, $value);
         }
     }
     if (count($params['get'])) {
         foreach ($params['get'] as $name => $value) {
             $this->_client->setParameterGet($name, $value);
         }
     }
     if (count($params['json'])) {
         //$this->_client->setHeaders('Content-type','application/json');
         $rawJson = json_encode($params['json']);
         //$this->_client->setRawData($rawJson);
         $this->_client->setRawData($rawJson, 'application/json');
     }
     $response = $this->_client->request($method);
     $result = $response->getBody();
     #echo $result . "\n\n <br>";
     return json_decode($result);
 }
开发者ID:rtsantos,项目名称:mais,代码行数:32,代码来源:Ice.php


示例12: getCoordinates

 /**
  * Gibt die Geokoordinaten anhand einer Adresse zurück
  *
  * @param string $address Die Adresse die geocodet werden woll
  * @return array|null $geocode Ein Array mit key 'lat' und 'lng'
  */
 public static function getCoordinates($address)
 {
     $q = $address;
     $q = str_replace(array('ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß'), array('ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss'), $q);
     $getParams = array('address' => $q, 'sensor' => 'false');
     $httpClientConfig = array('timeout' => 20, 'persistent' => false);
     $config = Kwf_Registry::get('config');
     if ($config->http && $config->http->proxy && $config->http->proxy->host && $config->http->proxy->port) {
         $httpClientConfig['adapter'] = 'Zend_Http_Client_Adapter_Proxy';
         $httpClientConfig['proxy_host'] = $config->http->proxy->host;
         $httpClientConfig['proxy_port'] = $config->http->proxy->port;
     }
     $client = new Zend_Http_Client("http://maps.googleapis.com/maps/api/geocode/json", $httpClientConfig);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet($getParams);
     $body = utf8_encode($client->request()->getBody());
     try {
         $result = Zend_Json::decode($body);
     } catch (Zend_Json_Exception $e) {
         $e = new Kwf_Exception_Other($e);
         $e->logOrThrow();
     }
     if (isset($result['results'][0]['geometry']['location']['lat']) && isset($result['results'][0]['geometry']['location']['lng'])) {
         return array('lat' => $result['results'][0]['geometry']['location']['lat'], 'lng' => $result['results'][0]['geometry']['location']['lng']);
     }
     return null;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:33,代码来源:Geocode.php


示例13: send

 function send()
 {
     global $tikilib;
     $entry = array();
     $lastModif = 0;
     $feed = $this->feed();
     foreach ($feed->feed->entry as $item) {
         if (empty($item->forwardlink->href)) {
             continue;
         }
         $client = new Zend_Http_Client($item->forwardlink->href, array('timeout' => 60));
         $info = $tikilib->get_page_info($item->page);
         if ($info['lastModif'] > $lastModif) {
             $lastModif = $info['lastModif'];
         }
     }
     if (!empty($feed->feed->entry)) {
         $client->setParameterGet(array('protocol' => 'forwardlink', 'contribution' => json_encode($feed)));
         try {
             $response = $client->request(Zend_Http_Client::POST);
             $request = $client->getLastResponse();
             return $response->getBody();
         } catch (Exception $e) {
             return "";
         }
     }
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:27,代码来源:Send.php


示例14: curlAction

 public function curlAction()
 {
     $base_url = "http://localhost:8080/NRServices/services/hello/hello/jack";
     $config = array('adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => array(CURLOPT_FOLLOWLOCATION => true));
     $http_client = new Zend_Http_Client($base_url, $config);
     $this->view->response = $http_client->request(Zend_Http_Client::GET);
 }
开发者ID:reechalee,项目名称:zf-tutorial,代码行数:7,代码来源:ExternalController.php


示例15: _purgeCacheServers

 /**
  * Process all servers
  */
 protected function _purgeCacheServers(array $headers)
 {
     $servers = $this->_getVarnishServers();
     if (empty($servers)) {
         return;
     }
     // process all servers
     foreach ($servers as $server) {
         // compile url string with scheme, domain/server and port
         $uri = 'http://' . $server;
         if ($port = trim(Mage::getStoreConfig(self::XML_PATH_VARNISH_PORT))) {
             $uri .= ':' . $port;
         }
         $uri .= '/';
         try {
             // create HTTP client
             $client = new Zend_Http_Client();
             $client->setUri($uri)->setHeaders($headers)->setConfig(array('timeout' => 15));
             // send PURGE request
             $response = $client->request('PURGE');
             // check response
             if ($response->getStatus() != '200') {
                 throw new Exception('Return status ' . $response->getStatus());
             }
         } catch (Exception $e) {
             Mage::helper('varnishcache')->debug('Purging on server ' . $server . ' failed (' . $e->getMessage() . ').');
         }
     }
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:32,代码来源:Control.php


示例16: shutdownHttpClient

 public function shutdownHttpClient(Zend_Http_Client $httpClient)
 {
     if (!isset($this->_restSession)) {
         $this->_restSession = new Zend_Session_Namespace('App_Rest_Service_' . $this->getRestService()->getServiceName() . '_Session');
     }
     $this->_restSession->cookieJar = $httpClient->getCookieJar();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:7,代码来源:Session.php


示例17: buildThumb

 public function buildThumb($mediaID, $thumbURL)
 {
     $targetLoc = XenForo_Helper_File::getExternalDataPath() . '/media/' . $mediaID . '.jpg';
     $thumbLoc = XenForo_Helper_File::getTempDir() . '/media' . $mediaID;
     if (substr($thumbURL, 0, 7) == 'http://') {
         $client = new Zend_Http_Client($thumbURL);
         $response = $client->request();
         $image = $response->getBody();
         file_put_contents($thumbLoc, $image);
     } else {
         copy($thumbURL, $thumbLoc);
     }
     $imageInfo = getimagesize($thumbLoc);
     if ($image = XenForo_Image_Abstract::createFromFile($thumbLoc, $imageInfo[2])) {
         $ratio = 160 / 90;
         $width = $image->getWidth();
         $height = $image->getHeight();
         if ($width / $height > $ratio) {
             $image->thumbnail($width, '90');
         } else {
             $image->thumbnail('160', $height);
         }
         $width = $image->getWidth();
         $height = $image->getHeight();
         $offWidth = ($width - 160) / 2;
         $offHeight = ($height - 90) / 2;
         $image->crop($offWidth, $offHeight, '160', '90');
         $image->output(IMAGETYPE_JPEG, $targetLoc);
     }
     if (file_exists($thumbLoc)) {
         unlink($thumbLoc);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:33,代码来源:Thumbs.php


示例18: getLatLng

 public function getLatLng($address)
 {
     # address identifier
     $address_identifier = 'latlng_' . str_replace(array(' '), array('_'), $address);
     $address_identifier = preg_replace('/[^a-z0-9_]+/i', '', $address);
     # registry
     $registry = Zend_Registry::getInstance();
     # caching
     $frontendOptions = array('lifetime' => 2592000, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => $registry->config->application->logs->tmpDir . '/cache/');
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     # get data
     if (($data = $cache->load($address_identifier)) === false) {
         new Custom_Logging('Hit Google: Lat/Lng for ' . $address, Zend_Log::INFO);
         $client = new Zend_Http_Client('http://maps.google.com/maps/geo?q=' . urlencode($address), array('maxredirects' => 0, 'timeout' => 30));
         $request = $client->request();
         $response = Zend_Http_Response::fromString($request);
         $body = Zend_Json::decode($response->getBody());
         $data = array();
         $data['latitude'] = !empty($body['Placemark'][0]['Point']['coordinates'][1]) ? $body['Placemark'][0]['Point']['coordinates'][1] : null;
         $data['longitude'] = !empty($body['Placemark'][0]['Point']['coordinates'][0]) ? $body['Placemark'][0]['Point']['coordinates'][0] : null;
         $cache->save($data, $address_identifier);
     } else {
         new Custom_Logging('(local cache) Hit Google: Lat/Lng for ' . $address, Zend_Log::INFO);
     }
     return $data;
 }
开发者ID:MarS2806,项目名称:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代码行数:27,代码来源:Google.php


示例19: __callStatic

 /**
 * 
 * Меджик метод для вызова удаленных процедур
 * @param string $methodName
 * @param array $params
 * @return array
 * @author NuR
 * @throws Zend_Http_Client_Exception
 * @example
 * 
 *      $data = array(
 *      			  'Service' => 'Citizen',
                      'Method' => 'showOrderList',
                      'userid' => 1
                      );
    
    Evil_Json_Rpc::make($data);
 */
 public static function __callStatic($methodName, $params)
 {
     $client = self::$_client;
     if (null == $client) {
         /**
          * дефолтный адрес
          */
         if (null == self::$rpcUrl) {
             $config = Zend_Registry::get('config');
             self::$rpcUrl = isset($config['jsonrpc']['url']) ? $config['jsonrpc']['url'] : null;
         }
         $options = array('maxredirects' => 5, 'timeout' => 300, 'useragent' => 'Evil_Json_Rpc');
         $client = new Zend_Http_Client(self::$rpcUrl);
         $client->setConfig($options);
         self::$_client = $client;
     }
     $requestParams = array('method' => $methodName, 'params' => $params, 'id' => self::$_requestId++);
     $request = Zend_Json::encode($requestParams);
     $client->setHeaders('Content-type', 'application/json');
     $client->setRawData($request);
     $response = $client->request('POST');
     try {
         return Zend_Json::decode($response->getBody());
     } catch (Exception $e) {
         return array('ex' => $e->__toString(), 'response' => $response->getBody());
     }
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:45,代码来源:Rpc.php


示例20: execute

 /**
  * @see Console\Command\Command
  */
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $supportSend = \SystemPref::get('support_send');
     if ($supportSend) {
         $stats = $this->getHelper('container')->getService('stat')->getAll();
         $statsUrl = 'http://stat.sourcefabric.org';
         $parameters = array('p' => 'newscoop');
         $parameters['installation_id'] = $stats['installationId'];
         $parameters['server'] = \SystemPref::get('support_stats_server');
         $parameters['ip_address'] = \SystemPref::get('support_stats_ip_address');
         $parameters['ram_used'] = $stats['ramUsed'];
         $parameters['ram_total'] = \SystemPref::get('support_stats_ram_total');
         $parameters['version'] = $stats['version'];
         $parameters['install_method'] = $stats['installMethod'];
         $parameters['publications'] = $stats['publications'];
         $parameters['issues'] = $stats['issues'];
         $parameters['sections'] = $stats['sections'];
         $parameters['articles'] = $stats['articles'];
         $parameters['articles_published'] = $stats['articlesPublished'];
         $parameters['languages'] = $stats['languages'];
         $parameters['authors'] = $stats['authors'];
         $parameters['subscribers'] = $stats['subscribers'];
         $parameters['backend_users'] = $stats['backendUsers'];
         $parameters['images'] = $stats['images'];
         $parameters['attachments'] = $stats['attachments'];
         $parameters['topics'] = $stats['topics'];
         $parameters['comments'] = $stats['comments'];
         $parameters['hits'] = $stats['hits'];
         $client = new \Zend_Http_Client();
         $client->setUri($statsUrl);
         $client->setParameterPost($parameters);
         $response = $client->request('POST');
     }
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:37,代码来源:SendStatsCommand.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Http_Client_Adapter_Interface类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Gdata_YouTube_VideoEntry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap