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


PHP Client::get方法代码示例

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


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

示例1: doGet

 /**
  * @param string $url relative URL
  * @return \GuzzleHttp\Message\FutureResponse|\GuzzleHttp\Message\ResponseInterface|\GuzzleHttp\Ring\Future\FutureInterface|null
  * @throws \Exception
  * @throws \GuzzleHttp\Exception\ClientException
  * @throws \InvalidArgumentException
  */
 protected function doGet($url)
 {
     if (!$url) {
         throw new \InvalidArgumentException('URL erforderlich!');
     }
     try {
         return $this->client->get($url);
     } catch (ClientException $e) {
         if ($e->getCode() == 404) {
             return null;
         }
         throw $e;
     }
 }
开发者ID:afk,项目名称:esv-client-php,代码行数:21,代码来源:AbstractResource.php

示例2: lxserver_main

function lxserver_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    global $argv, $argc;
    if ($argv[1] === 'slave') {
        $login = new Client(null, null, 'slave');
        $gbl->is_slave = true;
        $gbl->is_master = false;
        $rmt = unserialize(lfile_get_contents("__path_slave_db"));
        $login->password = $rmt->password;
        $argv[1] = "Running as Slave";
    } else {
        if ($argv[1] === 'master') {
            $login = new Client(null, null, 'admin');
            $gbl->is_master = true;
            $gbl->is_slave = false;
            $login->get();
            $argv[1] = "Running as Master";
        } else {
            print "Wrong arguments\n";
            exit;
        }
    }
    $login->cttype = 'admin';
    // Set php script execution timer to unlimited
    set_time_limit(0);
    // Start internal socket for remote
    some_server();
}
开发者ID:soar-team,项目名称:kloxo,代码行数:29,代码来源:lxserverlib.php

示例3: find

 /**
  * Retrieve an array of Publication objects according to a search query.
  *
  * @param array $query The query.
  * @return Publication[]
  */
 public static function find(array $query)
 {
     $pubs = Client::get('publication', $query);
     return array_map(function ($data) {
         return new self($data);
     }, $pubs);
 }
开发者ID:dsv-su,项目名称:daisy-api-client-php,代码行数:13,代码来源:Publication.php

示例4: getWeatherFor

 public function getWeatherFor($city)
 {
     $client = new Client(['base_uri' => 'http://api.openweathermap.org/data/2.5/', 'timeout' => 2.0]);
     $response = $client->get('weather?q=' . $city);
     $contents = $response->getBody()->getContents();
     return json_decode($contents);
 }
开发者ID:rocketage,项目名称:Acmetraining,代码行数:7,代码来源:MyBlock.php

示例5: getMimetype

 /**
  * Get the mimetype of a file.
  *
  * @param string $path
  *
  * @return array|false
  */
 public function getMimetype($path)
 {
     $stream = tmpfile();
     fwrite($stream, $this->client->get($path));
     rewind($stream);
     return ['mimetype' => Util::guessMimeType(stream_get_meta_data($stream)['uri'], stream_get_contents($stream))];
 }
开发者ID:patrickrose,项目名称:flysystem-redis,代码行数:14,代码来源:RedisAdapter.php

示例6: get

 /**
  * @param $url
  * @return Response
  */
 public function get($url)
 {
     $bits = explode('v=', $url);
     $videoId = end($bits);
     /** @var ResolveResponse $response */
     return parent::get(sprintf(self::API_URL, $this->apiKey, $videoId));
 }
开发者ID:peterculak,项目名称:apis,代码行数:11,代码来源:VideoResolver.php

示例7: getLastPage

 /**
  * @return Response|null
  */
 public function getLastPage()
 {
     if ($this->pages['last']) {
         return $this->client->get(str_replace(Request::API_URL, '', $this->pages['last']));
     }
     return NULL;
 }
开发者ID:nk2ge5k,项目名称:simaland-api,代码行数:10,代码来源:Response.php

示例8: create

 public function create($pid, $name, $identifier = null, $template = null)
 {
     if (!$identifier) {
         $identifier = Identifiers::getIdentifier($name);
         if (!$identifier) {
             throw new Exception("Identifier derived from dimension name '{$name}' is not valid. " . "Choose other name or custom identifier.");
         }
     }
     $call = $this->client->get("/gdc/md/{$pid}/data/sets");
     $existingDataSets = [];
     foreach ($call['dataSetsInfo']['sets'] as $r) {
         $existingDataSets[] = $r['meta']['identifier'];
     }
     if (!in_array(Identifiers::getDateDimensionId($name, $template), $existingDataSets)) {
         $this->client->getDatasets()->executeMaql($pid, sprintf('INCLUDE TEMPLATE "%s" MODIFY (IDENTIFIER "%s", TITLE "%s");', self::getTemplateUrn($template), $identifier, $name));
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:17,代码来源:DateDimensions.php

示例9: read

 /**
  * 
  * @param string $session_id
  * @return string
  */
 public function read($session_id)
 {
     if (isset($this->_cache[$session_id])) {
         return $this->_cache[$session_id];
     }
     $session_data = $this->_client->get($this->_prefix . $session_id)->data;
     return $this->_cache[$session_id] = $session_data === null ? '' : $session_data;
 }
开发者ID:chujiu,项目名称:phpssdb,代码行数:13,代码来源:SessionHandler.php

示例10: create

 public function create($pid, $name, $identifier = null)
 {
     if (!$identifier) {
         $identifier = Identifiers::getIdentifier($name);
         if (!$identifier) {
             throw new Exception("Identifier derived from dimension name '{$name}' is not valid. " . "Choose other name or custom identifier.");
         }
     }
     $call = $this->gdClient->get("/gdc/md/{$pid}/data/sets");
     $existingDataSets = [];
     foreach ($call['dataSetsInfo']['sets'] as $r) {
         $existingDataSets[] = $r['meta']['identifier'];
     }
     if (!in_array(self::getTimeDimensionIdentifier($name), $existingDataSets)) {
         $this->gdClient->getDatasets()->executeMaql($pid, self::getCreateMaql($identifier, $name));
     }
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:17,代码来源:TimeDimension.php

示例11: getSignedJSON

 /**
  * Perform a GET request, get a decoded JSON response.
  * Internally verifies an Ed25519 signature.
  *
  * @param string $url
  * @param SignaturePublicKey $publicKey
  * @param array $params
  * @return mixed
  */
 public function getSignedJSON(string $url, SignaturePublicKey $publicKey, array $params = [])
 {
     $response = $this->client->get($url, $this->params($params, $url));
     if ($response instanceof Response) {
         return $this->parseSignedJSON($response, $publicKey);
     }
     return null;
 }
开发者ID:paragonie,项目名称:airship,代码行数:17,代码来源:Hail.php

示例12: diff

 public function diff($pid, $model)
 {
     $uri = "/gdc/projects/{$pid}/model/diff?includeDeprecated=true&includeGrain=true";
     $result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
     if (isset($result['asyncTask']['link']['poll'])) {
         $try = 1;
         do {
             sleep(10 * $try);
             $taskResponse = $this->client->get($result['asyncTask']['link']['poll']);
             if (!isset($taskResponse['asyncTask']['link']['poll'])) {
                 if (isset($taskResponse['projectModelDiff']['updateScripts'])) {
                     $lessDestructive = [];
                     $moreDestructive = [];
                     // Preserve data if possible
                     foreach ($taskResponse['projectModelDiff']['updateScripts'] as $updateScript) {
                         if ($updateScript['updateScript']['preserveData'] && !$updateScript['updateScript']['cascadeDrops']) {
                             $lessDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!count($lessDestructive) && !$updateScript['updateScript']['preserveData'] && !$updateScript['updateScript']['cascadeDrops']) {
                             $lessDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!$updateScript['updateScript']['preserveData'] && $updateScript['updateScript']['cascadeDrops']) {
                             $moreDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                         if (!count($moreDestructive) && $updateScript['updateScript']['preserveData'] && $updateScript['updateScript']['cascadeDrops']) {
                             $moreDestructive = $updateScript['updateScript']['maqlDdlChunks'];
                         }
                     }
                     $description = [];
                     foreach ($taskResponse['projectModelDiff']['updateOperations'] as $o) {
                         $description[] = vsprintf($o['updateOperation']['description'], $o['updateOperation']['parameters']);
                     }
                     return ['moreDestructiveMaql' => $moreDestructive, 'lessDestructiveMaql' => $lessDestructive, 'description' => $description];
                 } else {
                     throw Exception::unexpectedResponseError('Polling of Model diff could not be finished', 'GET', $result['asyncTask']['link']['poll'], $taskResponse);
                 }
             }
             $try++;
         } while (true);
     } else {
         throw Exception::unexpectedResponseError('Polling of Model diff could not be started', 'POST', $uri, $result);
     }
     return false;
 }
开发者ID:keboola,项目名称:gooddata-php-client,代码行数:44,代码来源:ProjectModel.php

示例13: find

 /**
  * Retrieve an array of CourseSegmentInstance objects according to
  * a search query.
  *
  * @param array $query The query.
  * @return CourseSegmentInstance[]
  */
 public static function find(array $query)
 {
     if (isset($query['semester']) && $query['semester'] instanceof Semester) {
         $query['semester'] = $query['semester']->daisyFormat();
     }
     $csis = Client::get("courseSegment", $query);
     return array_map(function ($data) {
         return new self($data);
     }, $csis);
 }
开发者ID:dsv-su,项目名称:daisy-api-client-php,代码行数:17,代码来源:CourseSegmentInstance.php

示例14: test_set_get

 public function test_set_get()
 {
     $client = new Client();
     $client->addServers(array('127.0.0.1', 11211), array('127.0.0.1', 11212));
     $this->assertFalse($client->isConnected());
     $this->assertInstanceOf('\\Memcached', $client->getMemcached());
     $this->assertTrue($client->isConnected());
     $this->assertEquals(1, $client->set('foobar', 42));
     $this->assertEquals(42, $client->get('foobar'));
 }
开发者ID:blablacar,项目名称:memcached-client,代码行数:10,代码来源:ClientTest.php

示例15: up

 /**
  * Convert foreign id values from string to MongoId.
  *
  * @return void
  */
 public function up()
 {
     $db = \DB::getMongoDB();
     Client::get()->each(function (Client $client) use($db) {
         // The Client model has a mutator that converts lrs_id values to MongoId objects.
         $client->lrs_id = $client->lrs_id;
         $client->save();
     });
     echo 'Foreign id values in client collection converted from string to MongoId.' . PHP_EOL;
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:15,代码来源:2015_09_15_075532_client_foreign_ids.php


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