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


PHP Client::setParameterGet方法代码示例

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


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

示例1: executeQuery

 /**
  * @param $select
  * @param $from
  * @param $where
  * @param $format
  */
 public function executeQuery($select, $from, $where, $format = 'json')
 {
     $yql_query = "select {$select} from {$from} where {$where} ";
     $this->client->setParameterGet(array('q' => $yql_query, 'format' => $format));
     $response = $this->client->send();
     /* @var $response \Zend\Http\Response */
     if ($response->isSuccess()) {
         return $response->getBody();
     } else {
         throw new \Exception('Error - Response code: ' . $response->getStatusCode() . ' - query - ' . $yql_query);
     }
 }
开发者ID:machek,项目名称:mmyql,代码行数:18,代码来源:ServiceYQL.php

示例2: verify

 /**
  * Verify the user input
  *
  * @param $response
  *
  * @return Response
  * @throws \Exception
  */
 public function verify($response)
 {
     if (!$this->secretKey) {
         throw new Exception('Missing secret key');
     }
     $params = array('secret' => $this->secretKey, 'response' => $response);
     if ($this->ip !== null) {
         $params['ip'] = $this->ip;
     }
     $this->httpClient->setUri(self::VERIFY_SERVER);
     $this->httpClient->setParameterGet($params);
     if ($this->options) {
         $this->httpClient->setOptions($this->options);
     }
     $response = $this->httpClient->send();
     return new CaptchaResponse($response);
 }
开发者ID:szmnmichalowski,项目名称:zf2-nocaptcha,代码行数:25,代码来源:ReCaptcha.php

示例3: request

 /**
  * @param string $method
  * @param string $url
  * @param array [optional] $params
  */
 public function request($method, $url, $params = [])
 {
     $this->httpClient->setUri($this->moduleOptions->getApiUrl() . '/' . ltrim($url, '/'));
     $this->httpClient->setMethod($method);
     if (!is_null($params)) {
         if ($method == 'post' || $method == 'put') {
             $this->httpClient->setEncType(HttpClient::ENC_FORMDATA);
             $this->httpClient->setParameterPost($params);
         } else {
             $this->httpClient->setEncType(HttpClient::ENC_URLENCODED);
             $this->httpClient->setParameterGet($params);
         }
     }
     $response = $this->httpClient->send();
     $data = json_decode($response->getBody(), true);
     return $data;
 }
开发者ID:spalax,项目名称:eu-webchalange-download-images-api,代码行数:22,代码来源:Client.php

示例4: prepareHttpRequest

 /**
  * Prepare req
  *
  * @param Request $request
  * @return Client
  * @author Paolo Agostinetto <paul.ago@gmail.com>
  */
 protected function prepareHttpRequest(Request $request)
 {
     $client = new Client("https://api.thumbalizr.com/", array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl', 'curloptions' => array(CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE)));
     $client->setStream();
     // Use temp file
     $client->setParameterGet(array("api_key" => $this->apiKey, "quality" => $request->getQuality(), "width" => $request->getWidth(), "encoding" => $request->getEncoding(), "delay" => $request->getDelay(), "mode" => $request->getMode(), "bwidth" => $request->getBrowserWidth(), "bheight" => $request->getBrowserHeight(), "url" => $request->getUrl() . "&rnd=" . rand(100000, 999999999), "generate" => 0));
     return $client;
 }
开发者ID:agopaul,项目名称:thumbalizr,代码行数:15,代码来源:Thumbalizr.php

示例5: delete

 /**
  * @param string|array $identities
  *
  * @return bool
  */
 public function delete($identities)
 {
     $this->_client->setUri(implode('/', [self::getConfig()['uri'], 'file/delete']));
     if (!is_array($identities)) {
         $identities = (array) $identities;
     }
     $this->_client->setParameterGet(['ids' => $identities]);
     return $this->_client->send()->getStatusCode() == 200;
 }
开发者ID:execrot,项目名称:storage-client,代码行数:14,代码来源:Storage.php

示例6: getGeocodedLatitudeAndLongitude

 public function getGeocodedLatitudeAndLongitude($address)
 {
     $client = new Client();
     $client->setUri($this->_url);
     $client->setParameterGet(array('address' => urlencode($address), 'sensor' => 'false'));
     $client->setMethod('GET');
     $result = $client->send();
     $response = Decoder::decode($result->getBody(), Json::TYPE_OBJECT);
     return $response;
 }
开发者ID:benoitduval,项目名称:val,代码行数:10,代码来源:Googlemaps.php

示例7: cancel

 public function cancel($reference)
 {
     $url = $this->_server . "/nfe2/cancelar/";
     $client = new Client($url);
     $client->setMethod('GET');
     $client->setParameterGet(array('token' => $this->_token, 'ref' => $reference, 'justificativa' => $this->_justification));
     $response = $client->send();
     $this->_responseBody = $response->getBody();
     return $response->isSuccess();
 }
开发者ID:dindigital,项目名称:nfe-focus,代码行数:10,代码来源:CancelTransaction.php

示例8: connect

 public function connect($uri, $post = false, $params = null)
 {
     $client = new Client($uri, array('timeout' => 600, 'sslverifypeer' => false));
     if (!$post) {
         $client->setParameterGet($params);
     }
     $request = $client->getRequest();
     $response = $client->dispatch($request);
     return $response;
 }
开发者ID:ksr10,项目名称:bw,代码行数:10,代码来源:Connect.php

示例9: toCoordinates

 /**
  * used by the beo plugin only. We can hardcode the geoCoderUrl for the moment
  *
  * @param $input
  *
  * @return array|mixed|string
  */
 public function toCoordinates($input)
 {
     $client = new Client('http://api.cross-solution.de/geo');
     $client->setMethod('GET');
     $client->setParameterGet(array('q' => $input, 'country' => 'DE', 'coor' => 1, 'zoom' => 1, 'strict' => 0));
     $response = $client->send();
     $result = $response->getBody();
     $result = json_decode($result);
     $result = (array) $result->result;
     return $result;
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:18,代码来源:Converter.php

示例10: search

 private function search($query, $geolocate)
 {
     $query = urlencode($query);
     $client = new Client();
     $client->setAdapter('Zend\\Http\\Client\\Adapter\\Curl');
     $client->setOptions(['timeout' => 60]);
     $client->setAuth(BING_SEARCH_API_KEY, BING_SEARCH_API_KEY);
     $client->setUri('https://api.datamarket.azure.com/Bing/Search/v1/Web');
     $searchParams = $geolocate ? ['Market' => "'es-Cl'", 'Latitude' => '-33.45', 'Longitude' => '-70.6667', 'Query' => "'{$query}'", '$format' => 'json'] : ['Query' => "'{$query}'", '$format' => 'json'];
     $client->setParameterGet($searchParams);
     $response = $client->send();
     return $response->isSuccess() ? json_decode($response->getBody()) : null;
 }
开发者ID:AyerViernes,项目名称:monitor-busquedas,代码行数:13,代码来源:BingSearchCommand.php

示例11: getToken

 public function getToken()
 {
     if ($this->session->fbToken && $this->session->fbTokenExpires) {
         if (time() <= $this->session->fbTokenExpires) {
             return $this->session->fbToken;
         }
     }
     $code = $this->getCode();
     $this->http->setUri(self::FACEBOOK_AUTH_URI);
     $this->http->setParameterGet(array('client_id' => $this->fbClientId, 'redirect_uri' => 'http://' . $_SERVER['HTTP_HOST'] . '/', 'client_secret' => $this->fbSecret, 'code' => $code));
     $response = $this->http->send();
     if ($response->getStatusCode() != \Zend\Http\Response::STATUS_CODE_200) {
         throw new Exception\AuthException('Bad response from Facebook OAuth');
     }
     parse_str($response->getBody(), $parsedResponse);
     if (!array_key_exists('access_token', $parsedResponse) || !array_key_exists('expires', $parsedResponse)) {
         throw new Exception\AuthException('Bad parse from Facebook OAuth');
     }
     $this->session->fbToken = $parsedResponse['access_token'];
     $this->session->fbTokenExpires = time() + $parsedResponse['expires'];
     $this->session->offsetUnset('fbCode');
     return $this->session->fbToken;
 }
开发者ID:GeeH,项目名称:ZF2-Style-Facebook-Service,代码行数:23,代码来源:Connect.php

示例12: callRaynetcrmRestApi

 /**
  * Requests RAYNET Cloud CRM REST API. Check https://s3-eu-west-1.amazonaws.com/static-raynet/webroot/api-doc.html for any further details.
  *
  * @param $serviceName string URL service name
  * @param $method string Http method
  * @param $request array request
  * @return \Zend\Http\Response response
  */
 private function callRaynetcrmRestApi($serviceName, $method, $request)
 {
     $client = new Client('', array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl', 'curloptions' => array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false)));
     $client->setMethod($method);
     $client->setUri($this->buildUrl($serviceName));
     $client->setHeaders(array('X-Instance-Name' => $this->fInstanceName, 'Content-Type' => 'application/json; charset=UTF-8'));
     $client->setAuth($this->fUserName, $this->fApiKey);
     if ($method === self::HTTP_METHOD_GET) {
         $client->setParameterGet($request);
     } else {
         $client->setRawBody(Json::encode($request));
     }
     return $client->send();
 }
开发者ID:raynetcrm,项目名称:api,代码行数:22,代码来源:RaynetCrmRestClient.php

示例13: testHttpAuthBasicWithCredentialsInUri

 /**
  * Test that we can properly use Basic HTTP authentication by specifying username and password
  * in the URI
  *
  */
 public function testHttpAuthBasicWithCredentialsInUri()
 {
     $uri = str_replace('http://', 'http://%s:%s@', $this->baseuri) . 'testHttpAuth.php';
     $this->client->setParameterGet(array('user' => 'alice', 'pass' => 'secret', 'method' => 'Basic'));
     // First - fail password
     $this->client->setUri(sprintf($uri, 'alice', 'wrong'));
     $this->client->setMethod('GET');
     $res = $this->client->send();
     $this->assertEquals(401, $res->getStatusCode(), 'Expected HTTP 401 response was not recieved');
     // Now use good password
     $this->client->setUri(sprintf($uri, 'alice', 'secret'));
     $this->client->setMethod('GET');
     $res = $this->client->send();
     $this->assertEquals(200, $res->getStatusCode(), 'Expected HTTP 200 response was not recieved');
 }
开发者ID:navassouza,项目名称:zf2,代码行数:20,代码来源:CommonHttpTests.php

示例14: request

 public function request($service, array $params = [], $method = 'POST')
 {
     $result = false;
     try {
         $url = sprintf('https://api.superlogica.net/v2/financeiro%s', $service);
         $client = new Client($url);
         $client->setAdapter(new Curl());
         $client->setMethod($method);
         $client->setOptions(['curloptions' => [CURLOPT_HEADER => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false]]);
         $client->setHeaders($this->authHeader);
         if (!empty($params)) {
             if ($method == 'GET') {
                 $client->setParameterGet($params);
             } else {
                 $client->setParameterPost($params);
             }
         }
         $response = $client->send();
         if ($response->isSuccess()) {
             $body = $response->getContent();
             $json = Json\Json::decode($body, 1);
             if (!empty($json[0]['status'])) {
                 if ($json[0]['status'] == '200') {
                     $result = $json;
                 }
             } else {
                 $result = $json;
             }
         }
         $isException = false;
     } catch (\Zend\Http\Exception\RuntimeException $e) {
         $isException = true;
     } catch (\Zend\Http\Client\Adapter\Exception\RuntimeException $e) {
         $isException = true;
     } catch (Json\Exception\RuntimeException $e) {
         $isException = true;
     } catch (Json\Exception\RecursionException $e2) {
         $isException = true;
     } catch (Json\Exception\InvalidArgumentException $e3) {
         $isException = true;
     } catch (Json\Exception\BadMethodCallException $e4) {
         $isException = true;
     }
     if ($isException === true) {
         //código em caso de problemas no decode
     }
     return $result;
 }
开发者ID:armenio,项目名称:armenio-zf2-superlogica-module,代码行数:48,代码来源:Superlogica.php

示例15: sendMsg

 public function sendMsg($cellphones, $msg)
 {
     $client = new Client();
     $client->setUri($this->smsConfig['uri']);
     $query = array('CorpID' => $this->smsConfig['corpId'], 'Pwd' => $this->smsConfig['password'], 'Phones' => $cellphones, 'sContent' => iconv('UTF-8', 'GBK', $msg), 'ExtCode' => '', 'SendTime' => '');
     $client->setParameterGet($query);
     $client->setMethod(Request::METHOD_GET);
     $response = $client->send();
     if ($response->isSuccess()) {
         $result = $response->getBody();
         $code = (int) $result;
         return array('msgCode' => $code, 'msgText' => $this->getMsg($code));
     } else {
         return array('msgCode' => -100, 'msgText' => '短信服务器器响应失败');
     }
 }
开发者ID:brighten01,项目名称:zf2-openstack-api,代码行数:16,代码来源:SMSTool.php


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