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


PHP wfUtils::hostNotExcludedFromProxy方法代码示例

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


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

示例1: doCurlTest

function doCurlTest($protocol)
{
    if (!function_exists('curl_init')) {
        echo "<br /><b style='color: #F00;'>CURL is not installed</b>. Asking your hosting provider to install and enable CURL may improve any connection problems.</b><br />\n";
        return;
    }
    echo "<br /><b>STARTING CURL {$protocol} CONNECTION TEST....</b><br />\n";
    global $curlContent;
    $curlContent = "";
    $curl = curl_init($protocol . '://noc1.wordfence.com/');
    if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && wfUtils::hostNotExcludedFromProxy('noc1.wordfence.com')) {
        curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0);
        curl_setopt($curl, CURLOPT_PROXY, WP_PROXY_HOST . ':' . WP_PROXY_PORT);
        if (defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')) {
            curl_setopt($curl, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME . ':' . WP_PROXY_PASSWORD);
        }
    }
    curl_setopt($curl, CURLOPT_TIMEOUT, 900);
    curl_setopt($curl, CURLOPT_USERAGENT, "Wordfence.com UA " . (defined('WORDFENCE_VERSION') ? WORDFENCE_VERSION : '[Unknown version]'));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_WRITEFUNCTION, 'curlWrite');
    curl_exec($curl);
    $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if (strpos($curlContent, 'Your site did not send an API key') !== false) {
        echo "Curl connectivity test passed.<br /><br />\n";
    } else {
        $curlErrorNo = curl_errno($curl);
        $curlError = curl_error($curl);
        echo "Curl connectivity test failed with response: <pre>{$curlContent}</pre>";
        echo "<br />Curl HTTP status: {$httpStatus}<br />Curl error code: {$curlErrorNo}<br />Curl Error: {$curlError}<br /><br />\n";
    }
}
开发者ID:arobbins,项目名称:davis,代码行数:35,代码来源:conntest.php

示例2: wfsnIsBlocked

 private static function wfsnIsBlocked($IP, $type)
 {
     try {
         $curl = curl_init('http://noc3.wordfence.com:9050/hackAttempt/?k=' . wfConfig::get('apiKey') . '&IP=' . wfUtils::inet_aton($IP) . '&t=' . $type);
         if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && wfUtils::hostNotExcludedFromProxy('noc3.wordfence.com')) {
             curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0);
             curl_setopt($curl, CURLOPT_PROXY, WP_PROXY_HOST . ':' . WP_PROXY_PORT);
             if (defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')) {
                 curl_setopt($curl, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME . ':' . WP_PROXY_PASSWORD);
             }
         }
         curl_setopt($curl, CURLOPT_TIMEOUT, 3);
         curl_setopt($curl, CURLOPT_USERAGENT, "Wordfence.com UA " . (defined('WORDFENCE_VERSION') ? WORDFENCE_VERSION : '[Unknown version]'));
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($curl, CURLOPT_POST, false);
         $result = curl_exec($curl);
         if (preg_match('/BLOCKED:(\\d+)/', $result, $matches) && !self::getLog()->isWhitelisted($IP)) {
             return $matches[1];
         }
         return false;
     } catch (Exception $err) {
         return false;
     }
 }
开发者ID:christocmp,项目名称:bingopaws,代码行数:27,代码来源:wordfenceClass.php

示例3: binCall

 public function binCall($func, $postData)
 {
     $url = $this->getAPIURL() . '/v' . WORDFENCE_API_VERSION . '/?' . $this->makeAPIQueryString() . '&action=' . $func;
     if (function_exists('curl_init')) {
         $curl = curl_init($url);
         if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && wfUtils::hostNotExcludedFromProxy($url)) {
             error_log("BINCALL PROXY");
             curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 0);
             curl_setopt($curl, CURLOPT_PROXY, WP_PROXY_HOST . ':' . WP_PROXY_PORT);
             if (defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')) {
                 curl_setopt($curl, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME . ':' . WP_PROXY_PASSWORD);
             }
         }
         curl_setopt($curl, CURLOPT_TIMEOUT, 900);
         //curl_setopt($curl, CURLOPT_VERBOSE, true);
         curl_setopt($curl, CURLOPT_USERAGENT, "Wordfence");
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($curl, CURLOPT_POST, true);
         if ($postData) {
             curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
         } else {
             curl_setopt($curl, CURLOPT_POSTFIELDS, array());
         }
         $data = curl_exec($curl);
         $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
         if ($httpStatus != 200) {
             $cError = curl_error($curl);
             curl_close($curl);
             if ($cError) {
                 throw new Exception("We received an error response when trying to fetch binary data from the Wordfence scanning server. The HTTP status was [{$httpStatus}] with error: {$cError}");
             } else {
                 throw new Exception("We received an error HTTP response when trying to fetch binary data from the Wordfence scanning server: [{$httpStatus}]");
             }
         }
     } else {
         $data = $this->fileGet($url, $postData);
         if ($data === false) {
             $err = error_get_last();
             if ($err) {
                 throw new Exception("We received an error response when trying to fetch binary data from the Wordfence scanning server using file_get_contents: {$err}");
             } else {
                 throw new Exception("We received an error when trying to fetch binary data from the Wordfence scanning server using file_get_contents. There was no message explaining the error.");
             }
         }
         $httpStatus = '200';
     }
     if (preg_match('/\\{.*errorMsg/', $data)) {
         $jdat = @json_decode($data, true);
         if (is_array($jdat) && $jdat['errorMsg']) {
             throw new Exception($jdat['errorMsg']);
         }
     }
     return array('code' => $httpStatus, 'data' => $data);
 }
开发者ID:mariuskarma,项目名称:wp,代码行数:56,代码来源:wfAPI.php


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