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


PHP Http::get方法代码示例

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


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

示例1: all

 /**
  *
  * @return AddOn[]
  */
 public function all()
 {
     $path = $this->_config->merchantPath() . '/add_ons';
     $response = $this->_http->get($path);
     $addOns = ["addOn" => $response['addOns']];
     return Util::extractAttributeAsArray($addOns, 'addOn');
 }
开发者ID:atulparmar,项目名称:braintree_php,代码行数:11,代码来源:AddOnGateway.php

示例2: lists

 /**
  * 获取颜色列表
  *
  * @return array
  */
 public function lists()
 {
     $key = 'overtrue.wechat.colors';
     return $this->cache->get($key, function ($key) {
         $result = $this->http->get(self::API_LIST);
         $this->cache->set($key, $result['colors'], 86400);
         // 1 day
         return $result['colors'];
     });
 }
开发者ID:emilymwang8,项目名称:ajk-broker,代码行数:15,代码来源:Color.php

示例3: fetchScriptList

 protected function fetchScriptList()
 {
     $data = array('action' => 'query', 'format' => 'php', 'list' => 'allpages', 'apnamespace' => '8', 'aplimit' => '500');
     $baseUrl = $this->getArg(0);
     $pages = array();
     do {
         $url = wfAppendQuery($baseUrl, $data);
         $strResult = Http::get($url);
         //$result = FormatJson::decode( $strResult ); // Still broken
         $result = unserialize($strResult);
         if (!empty($result['query']['allpages'])) {
             foreach ($result['query']['allpages'] as $page) {
                 if (substr($page['title'], -3) === '.js') {
                     strtok($page['title'], ':');
                     $pages[] = strtok('');
                 }
             }
         }
         if (!empty($result['query-continue'])) {
             $data['apfrom'] = $result['query-continue']['allpages']['apfrom'];
             $this->output("Fetching new batch from {$data['apfrom']}\n");
         }
     } while (isset($result['query-continue']));
     return $pages;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:25,代码来源:importSiteScripts.php

示例4: render

 function render()
 {
     $group_id = Http::get("id");
     $smarty = $this->registry->get("smarty");
     $groups_model = DB::loadModel("users/groups");
     $permissions_model = DB::loadModel("users/permissions");
     $permissions = $permissions_model->getPermissions();
     $permissions_group = $permissions_model->getPermissionsGroup($group_id);
     $ids = array();
     foreach ($permissions_group as $pg) {
         $ids[] = $pg['permission_id'];
     }
     $pres = array();
     foreach ($permissions as $permission) {
         if (in_array($permission["id"], $ids)) {
             $permission["enabled"] = 1;
         } else {
             $permission["enabled"] = 0;
         }
         $pres[] = $permission;
     }
     $group = $groups_model->get($group_id);
     $smarty->assign('group_id', $group_id);
     $smarty->assign('group', $group);
     $smarty->assign('permissions', $pres);
     return $smarty->fetch(TMPL_PATH . "admin/users/group_edit.tpl");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:27,代码来源:group_edit.php

示例5: getUntranslatedPages

 protected function getUntranslatedPages($apiUrl, $category, $targetDomain)
 {
     $this->output("Fetching pages from {$category} not present in {$targetDomain} ...");
     $pages = array();
     $params = array('action' => 'query', 'format' => 'json', 'generator' => 'categorymembers', 'gcmtitle' => "Category:{$category}", 'gcmnamespace' => 0, 'gcmlimit' => 500, 'gcmsort' => 'timestamp', 'prop' => 'langlinks', 'lllang' => $targetDomain, 'lllimit' => 500, 'continue' => '');
     while (true) {
         $url = $apiUrl . http_build_query($params);
         $json = Http::get($url);
         $data = FormatJson::decode($json, true);
         if (!isset($data['query'])) {
             $this->output("\t[FAIL]\n");
             return array();
         }
         $pagesInCategory = $data['query']['pages'];
         foreach ($pagesInCategory as $pageId => $page) {
             if (!isset($page['langlinks'])) {
                 $pages[] = $page['title'];
             }
         }
         if (!isset($data['continue']) || count($pages) > 5000) {
             break;
         } else {
             unset($params['llcontinue']);
             unset($params['gcmcontinue']);
             $params += $data['continue'];
         }
     }
     $this->output("\t[OK]\n");
     return $pages;
 }
开发者ID:Wikia,项目名称:mediawiki-extensions-ContentTranslation,代码行数:30,代码来源:manage-lists.php

示例6: refresh

 function refresh($force = false)
 {
     // How often to check for updates
     $interval = $this->hook->apply('product_info_refresh_interval', 60 * 60 * 12);
     if (!$force && isset($this->data['last_refresh']) && $this->data['last_refresh'] > time() - $interval) {
         return false;
     }
     $http = new Http($this->config, $this->hook, $this->router);
     $response = $http->get($this->config->leeflets_api_url . '/product-info?slugs=core');
     if (Error::is_a($response)) {
         return $response;
     }
     if ((int) $response['response']['code'] < 200 || (int) $response['response']['code'] > 399) {
         return new Error('product_info_refresh_fail_http_status', 'Failed to refresh product info from leeflets.com. Received response ' . $response['response']['code'] . ' ' . $response['response']['message'] . '.', $response);
     }
     if (!($response_data = json_decode($response['body'], true))) {
         return new Error('product_info_refresh_fail_json_decode', 'Failed to refresh product info from leeflets.com. Error decoding the JSON response received from the server.', $response['body']);
     }
     $this->data = array();
     $this->data['last_refresh'] = time();
     $this->data['products'] = $response_data;
     $this->write();
     $this->load();
     return true;
 }
开发者ID:pcbrsites,项目名称:leeflets,代码行数:25,代码来源:product-info.php

示例7: fetchScriptList

 protected function fetchScriptList()
 {
     $data = ['action' => 'query', 'format' => 'json', 'list' => 'allpages', 'apnamespace' => '8', 'aplimit' => '500', 'continue' => ''];
     $baseUrl = $this->getArg(0);
     $pages = [];
     while (true) {
         $url = wfAppendQuery($baseUrl, $data);
         $strResult = Http::get($url, [], __METHOD__);
         $result = FormatJson::decode($strResult, true);
         $page = null;
         foreach ($result['query']['allpages'] as $page) {
             if (substr($page['title'], -3) === '.js') {
                 strtok($page['title'], ':');
                 $pages[] = strtok('');
             }
         }
         if ($page !== null) {
             $this->output("Fetched list up to {$page['title']}\n");
         }
         if (isset($result['continue'])) {
             // >= 1.21
             $data = array_replace($data, $result['continue']);
         } elseif (isset($result['query-continue']['allpages'])) {
             // <= 1.20
             $data = array_replace($data, $result['query-continue']['allpages']);
         } else {
             break;
         }
     }
     return $pages;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:31,代码来源:importSiteScripts.php

示例8: efTSPollRender

function efTSPollRender( $input, $args, $parser ) {

	// Control if the "id" is set. If not, it output a error
  if ( isset( $args['id'] ) && $args['id'] != "" ) {
		$id = wfUrlencode( $args['id'] );
	} else {
		
		return wfMsg( 'tspoll-id-error' );
	}
  
  // Control if "dev" is set. If not, it use the normal skript, else, it use the dev skript
  if ( isset( $args['dev'] ) && $args['dev'] == "1" ) { // If the arrgument dev is given, use the TSPoll-Dev-Version
      $get_server = Http::get( 'http://toolserver.org/~jan/poll/dev/main.php?page=wiki_output&id='.$id );
  } else { // sonst die normale Version verwenden
      $get_server = Http::get( 'http://toolserver.org/~jan/poll/main.php?page=wiki_output&id='.$id );
  }
 
  // If $get_server is empty it output a error
	if ( $get_server != '' ) {
		return $get_server;
	}
	else {
		
		return wfMsg( 'tspoll-fetch-error' );
	}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:TSPoll.php

示例9: getExternalData

 protected function getExternalData()
 {
     global $wgCityId;
     // Prevent recursive loop
     if ($wgCityId == self::EXTERNAL_DATA_SOURCE_WIKI_ID) {
         return array();
     }
     if (self::$externalData === false) {
         global $wgLang, $wgMemc;
         $code = $wgLang->getCode();
         $key = wfSharedMemcKey('user-command-special-page', 'lang', $code);
         $data = $wgMemc->get($key);
         if (empty($data)) {
             $data = array();
             $external = Http::get($this->getExternalDataUrl($code));
             $external = json_decode($external, true);
             if (is_array($external) && !empty($external['allOptions']) && is_array($external['allOptions'])) {
                 foreach ($external['allOptions'] as $option) {
                     $data[$option['id']] = $option;
                 }
             }
             $wgMemc->set($key, $data, self::EXTERNAL_DATA_CACHE_TTL);
         }
         self::$externalData = $data;
     }
     return self::$externalData;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:27,代码来源:SpecialPageUserCommand.php

示例10: getAccessPermission

 /**
  * 获取access token
  *
  * @param string $code
  *
  * @return string
  */
 public function getAccessPermission($code)
 {
     $access_token = new AccessTokenBiz($this->appId, $this->appSecret);
     $params = array('code' => $code, 'access_token' => $access_token->getToken());
     Log::info($params);
     return $this->lastPermission = $this->http->get(self::API_USER, $params);
 }
开发者ID:shoaly,项目名称:wechat-biz,代码行数:14,代码来源:AuthBiz.php

示例11: getlinksfromurl

 function getlinksfromurl($url, $namespaceID)
 {
     $html = Http::get($url, 120);
     $doc = new DOMDocument();
     @$doc->loadHTML($html);
     return $this->getlinksfromdocument($doc, $namespaceID);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:PageGrabberTask.php

示例12: extractVideoId

 protected function extractVideoId($url)
 {
     global $wgMemc;
     // See if this is a valid url
     if (!preg_match('#/[a-zA-Z0-9\\-]+/[a-zA-Z0-9\\-]*-(\\d+)#', $url, $matches)) {
         return null;
     }
     $videoId = $matches[1];
     $cacheKey = wfMemcKey('video', 'bliptv', $videoId);
     $cachedEmbedId = $wgMemc->get($cacheKey);
     if ($cachedEmbedId !== false) {
         return $cachedEmbedId;
     }
     list($apiUrl) = explode('?', $url);
     $apiUrl .= '?skin=api';
     $apiContents = Http::get($apiUrl);
     if (empty($apiContents)) {
         return null;
     }
     $dom = new DOMDocument('1.0', 'UTF-8');
     $dom->loadXML($apiContents);
     $embedId = $dom->getElementsByTagName('embedLookup')->item(0)->textContent;
     $wgMemc->set($cacheKey, $embedId, 60 * 60 * 24);
     return $embedId;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:BlipTVVideo.php

示例13: callback

 function callback($ctx)
 {
     $jump = htmlspecialchars(trim($_GET['jump']));
     self::validate_url($jump);
     if (!$this->appid || !$this->secret) {
         _redirect($jump);
     }
     $code = urlencode(htmlspecialchars(trim($_GET['code'])));
     if (!$code) {
         _redirect($jump);
     }
     $wx_url = 'https://api.weixin.qq.com/sns/oauth2/access_token';
     $wx_url = "{$wx_url}?appid={$this->appid}&secret={$this->secret}&code={$code}&grant_type=authorization_code";
     $resp = Http::get($wx_url);
     $ret = @json_decode($resp, true);
     if (is_array($ret) && $ret['openid']) {
         $connect = WxConnect::get_by('wx_openid', $ret['openid']);
         if ($connect) {
             Logger::info("wx_openid[{$ret['openid']}] oauth login, uid: {$connect->user_id}");
             $profile = Profile::get($connect->user_id);
             if ($profile && $profile->status != Profile::STATUS_LOCK) {
                 UC::force_login($profile);
             }
         } else {
             // 兼容 /weixin/bind, 因为它依赖 session 中的 openid, 所以这里设置
             session_start();
             $_SESSION['wx_openid'] = $ret['openid'];
         }
     } else {
         Logger::info("weixin oauth, code: {$code}, resp: {$resp}, " . Http::$error);
     }
     _redirect($jump);
 }
开发者ID:zxw5775,项目名称:yuhunclub,代码行数:33,代码来源:oauth.php

示例14: getReport

 /**
  * Return PageSpeed score and page statistics for a given URL
  *
  * @see http://code.google.com/intl/pl/apis/pagespeedonline/v1/getting_started.html#examples
  *
  * @param string $url page URL
  * @param array $options additional options
  * @return mixed report
  */
 public function getReport($url, array $options = array())
 {
     $apiUrl = self::PAGESPPED_API_URL . '?' . http_build_query(array('url' => $url, 'key' => $this->apiKey));
     $resp = Http::get($apiUrl);
     if (empty($resp)) {
         return false;
     }
     $resp = json_decode($resp, true);
     // prepare basic report
     $report = array('url' => $resp['id'], 'metrics' => array('pageSpeed' => intval($resp['score'])));
     // add the rest of the metrics
     $report['metrics'] += $resp['pageStats'];
     // serialized requests
     // "The following requests are serialized. Try to break up the dependencies to make them load in parallel."
     $report['metrics']['serializedRequests'] = $this->countReportedUrl($resp, 'AvoidExcessSerialization');
     // count redirects
     $report['metrics']['redirects'] = $this->countReportedUrl($resp, 'MinimizeRedirects');
     // count assets with short (less than 7 days) expiry time
     // "The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:"
     $report['metrics']['shortExpires'] = $this->countReportedUrl($resp, 'LeverageBrowserCaching');
     // count assets served uncompressed
     $report['metrics']['notGzipped'] = $this->countReportedUrl($resp, 'EnableGzipCompression');
     // count duplicated content served from different URLs
     $report['metrics']['duplicatedContent'] = $this->countReportedUrl($resp, 'ServeResourcesFromAConsistentUrl');
     // aggregate some of the stats
     $report['metrics']['totalResponseBytes'] = $resp['pageStats']['htmlResponseBytes'] + $resp['pageStats']['cssResponseBytes'] + (!empty($resp['pageStats']['imageResponseBytes']) ? $resp['pageStats']['imageResponseBytes'] : 0) + (!empty($resp['pageStats']['javascriptResponseBytes']) ? $resp['pageStats']['javascriptResponseBytes'] : 0) + (!empty($resp['pageStats']['otherResponseBytes']) ? $resp['pageStats']['otherResponseBytes'] : 0);
     return $report;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:37,代码来源:PerformanceMetricsGooglePageSpeed.class.php

示例15: render

 function render()
 {
     $user_id = Http::get("id");
     $smarty = $this->registry->get("smarty");
     $user_model = DB::loadModel("users/user");
     $groups_model = DB::loadModel("users/groups");
     $user_data = $user_model->get($user_id);
     $all_groups = $groups_model->getGroups();
     $user_groups = $groups_model->getUserGroups($user_id);
     $ids = array();
     foreach ($user_groups as $ug) {
         $ids[] = $ug["id"];
     }
     $user_all_groups = array();
     foreach ($all_groups as $group) {
         if (in_array($group["id"], $ids)) {
             $group["enabled"] = 1;
         } else {
             $group["enabled"] = 0;
         }
         $user_all_groups[] = $group;
     }
     $smarty->assign('user_id', $user_id);
     $smarty->assign('user_data', $user_data);
     $smarty->assign('user_groups', $user_all_groups);
     return $smarty->fetch(TMPL_PATH . "admin/users/user_edit.tpl");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:27,代码来源:user_edit.php


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