• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP w3_http_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中w3_http_get函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_http_get函数的具体用法?PHP w3_http_get怎么用?PHP w3_http_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: external_event

 /**
  * Makes external event request
  *
  * @param string $type
  * @param string $value
  * @return array
  */
 function external_event($type, $value)
 {
     $url = sprintf('%s?u=%s&tkn=%s&evnt_t=%s&evnt_v=%s', W3TC_CLOUDFLARE_EXTERNAL_EVENT_URL, urlencode($this->_config['email']), urlencode($this->_config['key']), urlencode($type), urlencode($value));
     $response = w3_http_get($url, '', false);
     if ($response) {
         return json_decode($response);
     }
     return false;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:16,代码来源:CloudFlare.php


示例2: external_event

 /**
  * Makes external event request
  *
  * @param string $type
  * @param string $value
  * @return array
  */
 function external_event($type, $value)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     $url = sprintf('%s?u=%s&tkn=%s&evnt_t=%s&evnt_v=%s', W3TC_CLOUDFLARE_EXTERNAL_EVENT_URL, urlencode($this->_config['email']), urlencode($this->_config['key']), urlencode($type), urlencode($value));
     $response = w3_http_get($url);
     if (!is_wp_error($response)) {
         return json_decode($response['body']);
     }
     return false;
 }
开发者ID:novuscory,项目名称:ACH,代码行数:17,代码来源:CloudFlare.php


示例3: w3_download

/**
 * Downloads URL into a file
 *
 * @param string $url
 * @param string $file
 * @return boolean
 */
function w3_download($url, $file)
{
    if (strpos($url, '//') === 0) {
        $url = (w3_is_https() ? 'https:' : 'http:') . $url;
    }
    $response = w3_http_get($url);
    if (!is_wp_error($response) && $response['response']['code'] == 200) {
        return @file_put_contents($file, $response['body']);
    }
    return false;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:18,代码来源:http.php


示例4: _request

 /**
  * Make API request
  *
  * @param string $url
  * @return string
  */
 function _request($url)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     require_once W3TC_INC_DIR . '/functions/url.php';
     $request_url = w3_url_format(W3TC_PAGESPEED_API_URL, array('url' => $url, 'key' => $this->key));
     $response = w3_http_get($request_url);
     if (!is_wp_error($response) && $response['response']['code'] == 200) {
         return $response['body'];
     }
     return false;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:17,代码来源:PageSpeed.php


示例5: test_rewrite

 /**
  * Perform rewrite test
  *
  * @param string $url
  * @return boolean
  */
 private function test_rewrite($url)
 {
     $key = sprintf('w3tc_rewrite_test_%s', substr(md5($url), 0, 16));
     $result = get_transient($key);
     if ($result === false) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/http.php');
         $response = w3_http_get($url);
         $result = !is_wp_error($response) && $response['response']['code'] == 200 && trim($response['body']) == 'OK';
         if ($result) {
             set_transient($key, $result, 30);
         } else {
             $key_result = sprintf('w3tc_rewrite_test_result_%s', substr(md5($url), 0, 16));
             set_transient($key_result, is_wp_error($response) ? $response->get_error_message() : implode(' ', $response['response']), 30);
         }
     }
     return $result;
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:23,代码来源:PgCacheAdminEnvironment.php


示例6: parse_sitemap

 /**
  * Parses sitemap
  *
  * @param string $url
  * @return array
  */
 function parse_sitemap($url)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     $urls = array();
     $response = w3_http_get($url);
     if (!is_wp_error($response) && $response['response']['code'] == 200) {
         $url_matches = null;
         $sitemap_matches = null;
         if (preg_match_all('~<sitemap>(.*?)</sitemap>~is', $response['body'], $sitemap_matches)) {
             $loc_matches = null;
             foreach ($sitemap_matches[1] as $sitemap_match) {
                 if (preg_match('~<loc>(.*?)</loc>~is', $sitemap_match, $loc_matches)) {
                     $loc = trim($loc_matches[1]);
                     if ($loc) {
                         $urls = array_merge($urls, $this->parse_sitemap($loc));
                     }
                 }
             }
         } elseif (preg_match_all('~<url>(.*?)</url>~is', $response['body'], $url_matches)) {
             $locs = array();
             $loc_matches = null;
             $priority_matches = null;
             foreach ($url_matches[1] as $url_match) {
                 $loc = '';
                 $priority = 0;
                 if (preg_match('~<loc>(.*?)</loc>~is', $url_match, $loc_matches)) {
                     $loc = trim($loc_matches[1]);
                 }
                 if (preg_match('~<priority>(.*?)</priority>~is', $url_match, $priority_matches)) {
                     $priority = (double) trim($priority_matches[1]);
                 }
                 if ($loc && $priority) {
                     $locs[$loc] = $priority;
                 }
             }
             arsort($locs);
             $urls = array_keys($locs);
         }
     }
     return $urls;
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:47,代码来源:PgCacheAdmin.php


示例7: w3_download

/**
 * Downloads data to a file
 *
 * @param string $url
 * @param string $file
 * @return boolean
 */
function w3_download($url, $file)
{
    if (strpos($url, '//') === 0) {
        $url = (w3_is_https() ? 'https:' : 'http:') . $url;
    }
    $data = w3_http_get($url);
    if ($data !== false) {
        return @file_put_contents($file, $data);
    }
    return false;
}
开发者ID:niko-lgdcom,项目名称:archives,代码行数:18,代码来源:define.php


示例8: _request

 /**
  * Make API request
  *
  * @param string $url
  * @return string
  */
 function _request($url)
 {
     $request_url = w3_url_format(W3TC_PAGESPEED_API_URL, array('url' => $url, 'key' => $this->key));
     $json = w3_http_get($request_url);
     return $json;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:12,代码来源:PageSpeed.php


示例9: update_ip_ranges

 /**
  * Check
  * @throws FilesystemOperationException
  * @throws FileOperationException
  */
 public function update_ip_ranges()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     $ip4_diff = $ip6_diff = false;
     $response = w3_http_get(W3TC_CLOUDFLARE_IP4_URL);
     $extensions_settings = $this->_config->get_array('extensions.settings', array());
     if (!is_wp_error($response)) {
         $ip4_data = $response['body'];
         $ip4_data = explode("\n", $ip4_data);
         $ip4_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip4', $this->_config, array());
         if ($ip4_diff = array_diff($ip4_data, $ip4_data_old)) {
             $extensions_settings['cloudflare']['ips.ip4'] = $ip4_data;
             $this->_config->set('extensions.settings', $extensions_settings);
         }
     }
     $response = w3_http_get(W3TC_CLOUDFLARE_IP6_URL);
     if (!is_wp_error($response)) {
         $ip6_data = $response['body'];
         $ip6_data = explode("\n", $ip6_data);
         $ip6_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip6', $this->_config, array());
         if ($ip6_diff = array_diff($ip6_data, $ip6_data_old)) {
             $extensions_settings['cloudflare']['ips.ip6'] = $ip6_data;
             $this->_config->set('extensions.settings', $extensions_settings);
         }
     }
     if ($ip4_diff || $ip6_diff) {
         try {
             $this->_config->save();
             $this->_config->refresh_cache();
         } catch (Exception $ex) {
         }
     }
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:38,代码来源:CloudFlareAPI.php


示例10: prime_post

 /**
  * Makes get requests to url specific to a post, its permalink
  * @param $post_id
  * @return boolean returns true on success
  */
 public function prime_post($post_id)
 {
     /** @var $purges W3_PageUrls */
     $purges = w3_instance('W3_PageUrls');
     $post_urls = $purges->get_post_urls($post_id);
     foreach ($post_urls as $url) {
         $result = w3_http_get($url);
         if (is_wp_error($result)) {
             return false;
         }
     }
     return true;
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:18,代码来源:Dispatcher.php


示例11: get_files_minify

 /**
  * Exports min files to CDN
  *
  * @return array
  */
 function get_files_minify()
 {
     $files = array();
     if (W3TC_PHP5 && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')))) {
         require_once W3TC_INC_DIR . '/functions/http.php';
         $minify =& w3_instance('W3_Plugin_Minify');
         $document_root = w3_get_document_root();
         $site_root = w3_get_site_root();
         $minify_root = w3_path(W3TC_CACHE_FILE_MINIFY_DIR);
         $minify_path = ltrim(str_replace($site_root, rtrim(w3_get_site_path(), '/'), $minify_root), '/');
         $urls = $minify->get_urls();
         if ($this->_config->get_string('minify.engine') == 'file') {
             foreach ($urls as $url) {
                 w3_http_get($url);
             }
             $files = $this->search_files($minify_root, $minify_path, '*.css;*.js');
         } else {
             foreach ($urls as $url) {
                 $file = w3_normalize_file_minify($url);
                 $file = w3_translate_file($file);
                 if (!w3_is_url($file)) {
                     $file = $document_root . '/' . $file;
                     $file = ltrim(str_replace($minify_root, '', $file), '/');
                     $dir = dirname($file);
                     if ($dir) {
                         w3_mkdir($dir, 0777, $minify_root);
                     }
                     if (w3_download($url, $minify_root . '/' . $file) !== false) {
                         $files[] = $minify_path . '/' . $file;
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:41,代码来源:Cdn.php


示例12: get_theme_recommendations

 /**
  * Returns theme recommendations
  *
  * @param string $theme_name
  * @return array
  */
 function get_theme_recommendations($theme_name)
 {
     $urls = $this->get_theme_urls($theme_name);
     $js_groups = array();
     $css_groups = array();
     @set_time_limit($this->_config->get_integer('timelimit.minify_recommendations'));
     foreach ($urls as $template => $url) {
         /**
          * Append theme identifier
          */
         $url .= (strstr($url, '?') !== false ? '&' : '?') . 'w3tc_theme=' . urlencode($theme_name);
         /**
          * If preview mode enabled append w3tc_preview
          */
         if (w3_is_preview_config()) {
             $url .= '&w3tc_preview=1';
         }
         /**
          * Get page contents
          * Don't check response code for 404 template
          */
         $content = w3_http_get($url, null, $template != '404');
         if ($content) {
             $js_files = $this->get_recommendations_js($content);
             $css_files = $this->get_recommendations_css($content);
             $js_groups[$template] = $js_files;
             $css_groups[$template] = $css_files;
         }
     }
     $js_groups = $this->_get_theme_recommendations($js_groups);
     $css_groups = $this->_get_theme_recommendations($css_groups);
     $recommendations = array($js_groups, $css_groups);
     return $recommendations;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:40,代码来源:TotalCache.php


示例13: prime_post

 /**
  * Makes get requests to url specific to a post, its permalink
  * @param $post_id
  * @return boolean returns true on success
  */
 public function prime_post($post_id)
 {
     /** @var $purges W3_SharedPageUrls */
     $purges = w3_instance('W3_SharedPageUrls');
     $post_urls = $purges->get_post_urls($post_id);
     /**
      * Make HTTP requests and prime cache
      */
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     w3_require_once(W3TC_INC_DIR . '/functions/url.php');
     foreach ($post_urls as $url) {
         $result = w3_http_get($url, array('user-agent' => ''));
         if (is_wp_error($result)) {
             return false;
         }
     }
     return true;
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:23,代码来源:PgCacheAdmin.php


示例14: update_ip_ranges

 /**
  * Check
  * @throws FilesystemOperationException
  * @throws FileOperationException
  */
 public function update_ip_ranges()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     $ip4_diff = $ip6_diff = false;
     $config_master = new W3_Config(true);
     $response = w3_http_get(W3TC_CLOUDFLARE_IP4_URL);
     if (!is_wp_error($response)) {
         $ip4_data = $response['body'];
         $ip4_data = explode("\n", $ip4_data);
         $ip4_data_old = $this->_config->get_array('cloudflare.ips.ip4');
         if ($ip4_diff = array_diff($ip4_data, $ip4_data_old)) {
             $config_master->set('cloudflare.ips.ip4', $ip4_data);
         }
     }
     $response = w3_http_get(W3TC_CLOUDFLARE_IP6_URL);
     if (!is_wp_error($response)) {
         $ip6_data = $response['body'];
         $ip6_data = explode("\n", $ip6_data);
         $ip6_data_old = $this->_config->get_array('cloudflare.ips.ip6');
         if ($ip6_diff = array_diff($ip6_data, $ip6_data_old)) {
             $config_master->set('cloudflare.ips.ip6', $ip6_data);
         }
     }
     if ($ip4_diff || $ip6_diff) {
         $config_master->save();
     }
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:32,代码来源:CloudFlare.php


示例15: test_rewrite

 /**
  * Perform rewrite test
  *
  * @param string $url
  * @return boolean
  */
 function test_rewrite($url)
 {
     $key = sprintf('w3tc_rewrite_test_%s', substr(md5($url), 0, 16));
     $result = get_transient($key);
     if ($result === false) {
         $response = w3_http_get($url);
         $result = !is_nxt_error($response) && $response['response']['code'] == 200 && trim($response['body']) == 'OK';
         if ($result) {
             set_transient($key, $result, 30);
         }
     }
     return $result;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:19,代码来源:TotalCacheAdmin.php


示例16: get_theme_recommendations

 /**
  * Returns theme recommendations
  *
  * @param string $theme_name
  * @return array
  */
 function get_theme_recommendations($theme_name)
 {
     $urls = $this->get_theme_urls($theme_name);
     $js_groups = array();
     $css_groups = array();
     @set_time_limit($this->_config->get_integer('timelimit.minify_recommendations'));
     foreach ($urls as $template => $url) {
         /**
          * Append theme identifier
          */
         $url .= (strstr($url, '?') !== false ? '&' : '?') . 'w3tc_theme=' . urlencode($theme_name);
         /**
          * If preview mode enabled append w3tc_preview
          */
         if ($this->_config->is_preview()) {
             $url .= '&w3tc_preview=1';
         }
         /**
          * Get page contents
          */
         $response = w3_http_get($url);
         if (!is_wp_error($response) && ($response['response']['code'] == 200 || $response['response']['code'] == 404 && $template == '404')) {
             $js_files = $this->get_recommendations_js($response['body']);
             $css_files = $this->get_recommendations_css($response['body']);
             $js_groups[$template] = $js_files;
             $css_groups[$template] = $css_files;
         }
     }
     $js_groups = $this->get_theme_recommendations_by_groups($js_groups);
     $css_groups = $this->get_theme_recommendations_by_groups($css_groups);
     $recommendations = array($js_groups, $css_groups);
     return $recommendations;
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:39,代码来源:MinifyAdminView.php


示例17: in_plugin_update_message

 /**
  * Show plugin changes
  *
  * @return void
  */
 function in_plugin_update_message()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/http.php');
     $response = w3_http_get(W3TC_README_URL);
     if (!is_wp_error($response) && $response['response']['code'] == 200) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
         w3_in_plugin_update_message($response['body']);
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:14,代码来源:TotalCacheAdmin.php


示例18: parse_sitemap

 /**
  * Parses sitemap
  *
  * @param string $xml
  * @return array
  */
 function parse_sitemap($url)
 {
     $urls = array();
     $xml = w3_http_get($url);
     if ($xml) {
         $url_matches = null;
         $sitemap_matches = null;
         if (preg_match_all('~<sitemap>(.*?)</sitemap>~is', $xml, $sitemap_matches)) {
             $loc_matches = null;
             foreach ($sitemap_matches[1] as $sitemap_match) {
                 if (preg_match('~<loc>(.*?)</loc>~is', $sitemap_match, $loc_matches)) {
                     $loc = trim($loc_matches[1]);
                     if ($loc) {
                         $urls = array_merge($urls, $this->parse_sitemap($loc));
                     }
                 }
             }
         } elseif (preg_match_all('~<url>(.*?)</url>~is', $xml, $url_matches)) {
             $locs = array();
             $loc_matches = null;
             $priority_matches = null;
             foreach ($url_matches[1] as $url_match) {
                 $loc = '';
                 $priority = 0;
                 if (preg_match('~<loc>(.*?)</loc>~is', $url_match, $loc_matches)) {
                     $loc = trim($loc_matches[1]);
                 }
                 if (preg_match('~<priority>(.*?)</priority>~is', $url_match, $priority_matches)) {
                     $priority = (double) trim($priority_matches[1]);
                 }
                 if ($loc && $priority) {
                     $locs[$loc] = $priority;
                 }
             }
             arsort($locs);
             $urls = array_keys($locs);
         }
     }
     return $urls;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:46,代码来源:PgCache.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP w3_instance函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_get_site_root函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap