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


PHP Zend_Http_Client::setParameterGet方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $client = new Zend_Http_Client('https://ws.pagseguro.uol.com.br/v2/sessions/');
     $client->setMethod(Zend_Http_Client::POST);
     $client->setParameterGet('email', 'ricardo@ricardomartins.info');
     $client->setParameterGet('token', '9F79900A9B454CE6B18613D7224C0621');
     $client->request();
     var_dump($client->getLastResponse()->getBody());
 }
开发者ID:Mr-Leonardooliveira,项目名称:PagSeguro-Magento-Transparente,代码行数:9,代码来源:TestController.php

示例2: getTimeStamp

 private static function getTimeStamp()
 {
     //May be used soon for encrypting forwardlinks
     if (isset($_REQUEST['action'], $_REQUEST['hash']) && $_REQUEST['action'] == 'timestamp') {
         $client = new Zend_Http_Client(TikiLib::tikiUrl() . 'tiki-timestamp.php', array('timeout' => 60));
         $client->setParameterGet('hash', $_REQUEST['hash']);
         $client->setParameterGet('clienttime', time());
         $response = $client->request();
         echo $response->getBody();
         exit;
     }
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:12,代码来源:ForwardLink.php

示例3: isValid

 public function isValid()
 {
     if (!$this->getAddresses()) {
         return true;
     }
     $userId = $this->getConfigData('userid');
     $request = "<AddressValidateRequest USERID='{$userId}'>";
     foreach ($this->getAddresses() as $id => $address) {
         $regionCode = Mage::getModel('directory/region')->load($address['region_id'])->getCode();
         $request .= '<Address ID="' . $id . '">';
         if (isset($address['street'][1])) {
             $address1 = $address['street'][0];
             $address2 = $address['street'][1];
         } else {
             $address1 = '';
             $address2 = $address['street'][0];
         }
         $request .= '<Address1>' . $address1 . '</Address1>';
         $request .= '<Address2>' . $address2 . '</Address2>';
         $request .= '<City>' . $address['city'] . '</City>';
         $request .= '<State>' . $regionCode . '</State>';
         $request .= '<Zip5>' . $address['postcode'] . '</Zip5>';
         $request .= '<Zip4></Zip4>';
         $request .= '</Address>';
     }
     $request .= "</AddressValidateRequest>";
     $responseBody = $this->_getCachedQuotes($request);
     if ($responseBody === null) {
         $debugData = array('request' => $request);
         try {
             $url = $this->getConfigData('gateway_url');
             if (!$url) {
                 $url = $this->_defaultGatewayUrl;
             }
             $client = new Zend_Http_Client();
             $client->setUri($url);
             $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
             $client->setParameterGet('API', 'Verify');
             $client->setParameterGet('XML', $request);
             $response = $client->request();
             $responseBody = $response->getBody();
             $debugData['result'] = $responseBody;
             $this->_setCachedQuotes($request, $responseBody);
         } catch (Exception $e) {
             $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
             $responseBody = '';
         }
         $this->_debug($debugData);
     }
     $this->_result = $this->_parseXmlResponse($responseBody);
     return !$this->getError() && $this->isVerified();
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:52,代码来源:Usps.php

示例4: analytics

 /** Get analytics for a URL
  * @access public
  * @param string $shortUrl
  * @return object $response
  */
 public function analytics($shortUrl)
 {
     $url = $this->checkShortUrl($shortUrl);
     $client = new Zend_Http_Client();
     $client->setUri($this->_api);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet('shortUrl', $shortUrl);
     $client->setParameterGet('projection', 'FULL');
     $response = $client->request();
     if ($response->isSuccessful()) {
         return $this->getDecode($response);
     } else {
         return false;
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:20,代码来源:GoogleShortUrl.php

示例5: _shortenUrl

 protected function _shortenUrl($url)
 {
     $http = new \Zend_Http_Client();
     $http->setUri('http://api.bitly.com/v3/shorten');
     $http->setParameterGet('login', $this->_config->bitLyLogin);
     $http->setParameterGet('apiKey', $this->_config->bitLyApiKey);
     $http->setParameterGet('longUrl', $url);
     $http->setParameterGet('format', 'json');
     $res = $http->request('GET');
     $body = json_decode($res->getBody());
     if (!isset($body->data) || !isset($body->data->url)) {
         throw new \Exception('Bit.ly url not returned');
     }
     return $body->data->url;
 }
开发者ID:JaroslavRamba,项目名称:ex-facebook-bundle,代码行数:15,代码来源:DebugLogUploader.php

示例6: executeRequest

 public function executeRequest(TingClientHttpRequest $request)
 {
     //Transfer request configuration to Zend Client
     $method = $request->getMethod();
     $class = new ReflectionClass(get_class($this->client));
     $this->client->setMethod($class->getConstant($method));
     $this->client->setUri($request->getBaseUrl());
     $this->client->setParameterGet($request->getParameters(TingClientHttpRequest::GET));
     $this->client->setParameterPost($request->getParameters(TingClientHttpRequest::POST));
     //Check for errors
     $response = $this->client->request();
     if ($response->isError()) {
         throw new TingClientException('Unable to excecute Zend Framework HTTP request: ' . $response->getMessage(), $response->getStatus());
     }
     return $response->getBody();
 }
开发者ID:reload,项目名称:ting-client,代码行数:16,代码来源:TingClientZfHttpRequestAdapter.php

示例7: send

 public function send($phone, $text)
 {
     if ($this->_validatePhone($phone)) {
         $reqest = array('phone' => $phone, 'text' => $text);
         /**
          * 
          * Запрос формируется мержем массивом с параметрами, причем настройки указанные в конфиге 
          * в критичных местах могут перехзаписаться
          * @var array
          */
         $reqest = array_merge($this->_config, $reqest, $this->_defaultRequest);
         $client = new Zend_Http_Client($this->_apiUrl);
         $client->setParameterGet($reqest);
         $result = $client->request('POST');
         $jsonResponse = $result->getBody();
         $json = Zend_Json::decode($jsonResponse);
         if (0 == $json['response']['msg']['err_code']) {
             return true;
         } else {
             $this->_log($json['response']['msg']['text'] . ' ' . var_export($reqest, true), Zend_Log::CRIT);
             return false;
         }
     } else {
         $this->_log('Номер телефона не корректный: ' . var_export($reqest, true), Zend_Log::ERR);
         return false;
     }
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:27,代码来源:Sms24x7.php

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

示例9: photosAction

 public function photosAction()
 {
     require_once 'Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Http_Client');
     $CLIENT_ID = 'fa2641332bca4ce6bd8f71bd4345cc0f';
     $CLIENT_SECRET = 'c44e29e7449444e3bc1f58ff499f5e8e';
     $user = '332756956';
     $tag = 'coreprojectua';
     try {
         $client = new Zend_Http_Client('https://api.instagram.com/v1/users/' . $user . '/media/recent');
         $client->setParameterGet('client_id', $CLIENT_ID);
         $response = $client->request();
         $result = json_decode($response->getBody());
         $data = $result->data;
         if (count($data) > 0) {
             $this->view->user = $data;
         }
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . print_r($client);
         exit;
     }
     try {
         $client = new Zend_Http_Client('https://api.instagram.com/v1/tags/' . $tag . '/media/recent');
         $client->setParameterGet('client_id', $CLIENT_ID);
         $response = $client->request();
         $result = json_decode($response->getBody());
         $data = $result->data;
         if (count($data) > 0) {
             $this->view->tag = $data;
         }
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . print_r($client);
         exit;
     }
 }
开发者ID:Kostornychenko,项目名称:coreproject,代码行数:35,代码来源:IndexController.php

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

示例11: validateTicket

 /**
  * Validate a ticket for a service.
  *
  * @param string $ticket  Ticket to validate given by CAS Server
  * @param string $service URL to the service requesting authentication
  * @uses    Zend_Http_Client
  *
  * @return false|string     Returns false on failure, CAS user on success.
  */
 protected function validateTicket($ticket, $service)
 {
     /**
      * @see Zend_Http_Client
      */
     require_once 'Zend/Http/Client.php';
     try {
         if (!$this->_clientAdapter instanceof Zend_Http_Client_Adapter_Interface) {
             $this->setClientAdapter();
         }
         $this->setClient();
         // Pass parameters ticket and service to client
         $this->_client->setParameterGet($this->getValidationParams($ticket, $service));
         // Get the client response
         $response = $this->_client->request();
         if ($response->getStatus() == 200) {
             $result = $this->getResponseBody($response->getBody());
             if ($result === false) {
                 return false;
             } else {
                 return $result;
             }
         }
         return false;
     } catch (Exception $e) {
         // Set error messages for failure
         $this->_errors[] = 'Authentication failed: Failed to connect to server';
         $this->_errors[] = $e->getMessage();
         return false;
     }
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:40,代码来源:Cas.php

示例12: postComment

 /**
  * Post a comment.
  *
  * @param string $code
  * @param string $message
  * @param array $options
  * @param string $format
  */
 public function postComment($code, $message, $options = array(), $format = self::FORMAT_XML)
 {
     $defaults = array('name' => '', 'email' => '', 'tweet' => 0);
     $options = array_merge($defaults, $options);
     if (!strlen($options['name']) && !strlen($options['email'])) {
         if (null == $this->_username && null == $this->_password) {
             throw new HausDesign_Service_Mobypicture_Exception('name and email or username and password should by defined');
         }
     }
     $this->_localHttpClient->resetParameters();
     $this->_localHttpClient->setUri(self::MOBYPICTURE_API);
     $this->_localHttpClient->setParameterGet('action', 'postComment');
     if (!strlen($options['name']) && !strlen($options['email'])) {
         $this->_localHttpClient->setParameterGet('u', $this->_username);
         $this->_localHttpClient->setParameterGet('p', $this->_password);
     }
     $this->_localHttpClient->setParameterGet('k', $this->_apiKey);
     $this->_localHttpClient->setParameterGet('tinyurl_code ', $code);
     $this->_localHttpClient->setParameterGet('message', $code);
     $this->_localHttpClient->setParameterGet('format', $format);
     foreach ($options as $option => $value) {
         $this->_localHttpClient->setParameterGet($option, $value);
     }
     return $this->_parseContent($this->_localHttpClient->request('GET')->getBody(), $format);
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:33,代码来源:Mobypicture.php

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

示例14: run

 /**
  * 
  */
 public function run()
 {
     $_job = new Tools_DataView_Job_MapperView();
     $_job->setId($this->jobId)->retrieve();
     try {
         $start = ZendT_Type_Date::nowDateTime();
         $config = array('useragent' => 'Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/44.0', 'encodecookies' => false, 'timeout' => 60 * 60);
         $params = Tools_Interface_Job::prepareParams($_job->getParametro()->toPhp());
         $_client = new Zend_Http_Client($_job->getProcedimento()->toPhp(), $config);
         if (count($params) > 0) {
             foreach ($params as $name => $value) {
                 $_client->setParameterGet($name, $value);
             }
         }
         $response = $_client->request();
         $message = $response->getBody();
         if ($message == '' || $message == 'OK') {
         } else {
             Tools_Model_LogErro_Mapper::log($_job->getProcedimento()->toPhp(), $message);
         }
         $finish = ZendT_Type_Date::nowDateTime();
         $diff = $start->diff($finish);
         $_job->setTempoUlExec($diff->i);
     } catch (Exception $ex) {
         $message = 'Mensagem: ' . $ex->getMessage() . "\n";
         $message .= 'Erro: ' . $ex->getTraceAsString() . "\n";
         Tools_Model_LogErro_Mapper::log($_job->getProcedimento()->toPhp(), $message);
         $_job->setTempoUlExec(0);
     }
     $_job->setDhUltExec(ZendT_Type_Date::nowDateTime());
     $_job->setStatus('A');
     $_job->update();
     return true;
 }
开发者ID:rtsantos,项目名称:mais,代码行数:37,代码来源:Http.php

示例15: mailgunRequest

 public function mailgunRequest($type, $domain, $apiKey, $data, $method = Zend_Http_Client::GET, $uriOveride = false)
 {
     $client = new Zend_Http_Client();
     $client->setAuth("api", $apiKey);
     $client->setMethod($method);
     if ($uriOveride) {
         $client->setUri($uriOveride);
     } else {
         $client->setUri($this->apiUrl . $domain . "/" . $type);
     }
     if ($method == Zend_Http_Client::POST) {
         foreach ($data as $key => $value) {
             $client->setParameterPost($key, $value);
         }
     } else {
         foreach ($data as $key => $value) {
             $client->setParameterGet($key, $value);
         }
     }
     try {
         $response = $client->request();
         if ($response->getStatus() == 200) {
             return json_decode($response->getBody());
         } else {
             throw new Zend_Http_Exception("Error connecting to MailGun API. Returned error code: " . $response->getStatus() . " --- " . $response->getBody());
         }
     } catch (Exception $e) {
         Mage::logException($e);
         return false;
     }
 }
开发者ID:reidblomquist,项目名称:mailgun_magento,代码行数:31,代码来源:Mailgun.php


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