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