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


PHP getallheaders函数代码示例

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


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

示例1: ValidateToken

 function ValidateToken()
 {
     try {
         $headers = getallheaders();
         if (!isset($headers['Authorization'])) {
             return;
         }
         $tokenObject = explode(' ', $headers['Authorization']);
         if (count($tokenObject) != 2) {
             return;
         }
         $tokenValue = $tokenObject[1];
         if ($tokenValue == NULL || $tokenValue == '') {
             return;
         }
         JWT::$leeway = 60 * 60 * 24;
         //24 hours
         $decoded = JWT::decode($tokenValue, "JWT_KEY", array('HS256'));
         if (empty($decoded)) {
             return;
         }
         $decoded_array = (array) $decoded;
         if (empty($decoded_array)) {
             return;
         }
         self::$token = $tokenValue;
         self::$userId = $decoded_array['uid'];
         self::$isAuthorized = TRUE;
     } catch (UnexpectedValueException $e) {
         return;
     } catch (Exception $e) {
         return;
     }
 }
开发者ID:vitalsaude,项目名称:api,代码行数:34,代码来源:JWT_Controller.php

示例2: render

 public function render()
 {
     $headers = array();
     $response = '';
     if (count($this->route_matches) > 1) {
         $site = $this->route_matches[1];
         if (!preg_match('@^https?://@i', $site)) {
             $site = 'http://' . $site;
         }
         $headers = @get_headers($site);
         if (!$headers) {
             error400('Headers could not be retrieved for that domain.');
             return;
         }
         foreach ($headers as $header) {
             $response .= htmlspecialchars($header . "\n");
         }
     } else {
         $headers = getallheaders();
         foreach ($headers as $key => $value) {
             if (server_or_default('HTTP_X_DAGD_PROXY') == "1") {
                 if (strpos($key, 'X-Forwarded-') === 0 || $key == 'X-DaGd-Proxy') {
                     continue;
                 }
             }
             $response .= htmlspecialchars($key . ': ' . $value . "\n");
         }
     }
     return $response;
 }
开发者ID:relrod,项目名称:dagd,代码行数:30,代码来源:headers.php

示例3: datapointAdd

function datapointAdd($value)
{
    global $mysql_link;
    $ip = $_SERVER["REMOTE_ADDR"];
    $temp = getallheaders();
    $apikey = $temp['U-ApiKey'];
    $json = json_decode($value);
    //$sql = "INSERT INTO datapoint (timestamp, value, API,ip) VALUES (now(), '$value', '$apikey','$ip')";
    echo var_dump($json) . "\n";
    $type = $json->{'type'};
    if ($type == 'TH') {
        $temperature = $json->{'temperature'};
        $humidity = $json->{'humidity'};
        $sql = "INSERT INTO datapoint (timestamp, value,type, API,ip) VALUES (now(), '{$temperature}','count', '{$apikey}','{$ip}')";
        $sql = $sql . "," . "(now(), '{$humidity}','inout', '{$apikey}','{$ip}')";
        echo $sql;
    }
    if ($type == 'PO') {
        $temperature = $json->{'temperature'};
        $humidity = $json->{'humidity'};
        $sql = "INSERT INTO datapoint (timestamp, value,type, API,ip) VALUES (now(), '{$temperature}','point1', '{$apikey}','{$ip}')";
        //$sql = $sql . "," . "(now(), '$humidity','humidity', '$apikey','$ip')";
        echo $sql;
    }
    $result = mysql_query($sql, $mysql_link);
    if ($result == 1) {
        return "SUCCESS";
    } else {
        return "FAILED";
    }
}
开发者ID:gaoshine,项目名称:neuronII,代码行数:31,代码来源:utils.php

示例4: getHeaders

 public function getHeaders() : array
 {
     if ($this->{$headers} === null) {
         $this->{$headers} = getallheaders();
     }
     return $this->{$headers};
 }
开发者ID:inad9300,项目名称:bed.php,代码行数:7,代码来源:Request.php

示例5: logRequests

function logRequests()
{
    $fd = fopen("trace.txt", "a");
    if (!$fd) {
        exit("File open errror!");
    }
    fwrite($fd, "***************************\n");
    fwrite($fd, "\n");
    fwrite($fd, date("D M j G:i:s T Y") . "\n");
    fwrite($fd, "\n");
    $arrRequestHeaders = array();
    $arrRequestHeaders = getallheaders();
    fwrite($fd, "\n");
    fwrite($fd, "HTTP REQUEST HEADERS" . "\n");
    fwrite($fd, "\n");
    foreach ($arrRequestHeaders as $key => $value) {
        fwrite($fd, "{$key}" . ' = ' . "{$value}" . "\n");
    }
    $arrRequest = array();
    $arrRequest = $_POST;
    fwrite($fd, "\n");
    fwrite($fd, "HTTP REQUEST PARAMS" . "\n");
    fwrite($fd, "\n");
    foreach ($arrRequest as $key => $value) {
        fwrite($fd, "{$key}" . ' = ' . "{$value}" . "\n");
    }
    fwrite($fd, "\n");
    fwrite($fd, "***************************\n");
    fclose($fd);
}
开发者ID:AlehSkamarokhau,项目名称:PrototypeApps,代码行数:30,代码来源:logerController.php

示例6: getHeaders

 public function getHeaders()
 {
     $headers = getallheaders();
     $ignored_headers = array('Accept-Encoding', 'Connection', 'Content-Length', 'Fastly-Client', 'Fastly-Client-IP', 'Fastly-FF', 'Fastly-Orig-Host', 'Fastly-SSL', 'Host', 'X-Forwarded-Host', 'X-Forwarded-Server', 'X-Varnish', 'Via', 'X-Amz-Cf-Id');
     if (!Conf::$cookies_enabled) {
         $ignored_headers[] = 'Cookie';
     }
     foreach ($ignored_headers as $ignored_header) {
         if (isset($headers[$ignored_header])) {
             unset($headers[$ignored_header]);
         }
         $ignored_header_alt = strtolower($ignored_header);
         if (isset($headers[$ignored_header_alt])) {
             unset($headers[$ignored_header_alt]);
         }
     }
     foreach ($headers as $key => &$value) {
         TextExternalUrlFilters::applyReverse($value);
     }
     // Proxy standard headers.
     if (!isset($headers['X-Forwarded-For'])) {
         $headers['X-Forwarded-For'] = $_SERVER['REMOTE_ADDR'];
     }
     if (!isset($headers['X-Real-IP'])) {
         $real_ip = $headers['X-Forwarded-For'];
         // If multiple (command-separated) forwarded IPs, use the first one.
         if (strpos($real_ip, ',') !== false) {
             list($real_ip) = explode(',', $real_ip);
         }
         $headers['X-Real-IP'] = $real_ip;
     }
     return $headers;
 }
开发者ID:julienkermarec,项目名称:GreatFire_OVH_Test,代码行数:33,代码来源:ProxyHttpRequest.inc.php

示例7: getRequestHeader

 public static function getRequestHeader($name)
 {
     $headers = getallheaders();
     if (empty($headers[$name]) == false) {
         return $headers[$name];
     }
 }
开发者ID:benconnito,项目名称:kopper,代码行数:7,代码来源:Utility.php

示例8: nojs

function nojs()
{
    $ip = $_SERVER['REMOTE_ADDR'];
    $host = gethostbyaddr($ip);
    if (!isset($_SERVER['HTTP_REFERER'])) {
        $ref = 'None';
    } else {
        $ref = htmlspecialchars($_SERVER['HTTP_REFERER']);
    }
    if (function_exists('getallheaders')) {
        foreach (getallheaders() as $header => $info) {
            $req .= htmlspecialchars($header) . ' - ' . htmlspecialchars($info) . '<br />';
        }
    } else {
        $req = 'Undefined';
    }
    $data = '<center><a href="#' . hash . '" onclick="show(\'' . hash . '\');"><h4>' . $ip . '</h4></a></center>' . '<div id="' . hash . '" style="display:none;"><hr /><p>' . time . '</p><div class="text">' . '<h3>Info</h3>' . '<br />IP - <a href="http://ipinfo.io/' . $ip . '">' . $ip . '</a>' . '<br />Host - ' . $host . '<br />Referer - ' . $ref . '<br />Javascript not enabled!' . '<br /><h3>Request headers</b></h3> ' . $req;
    if (file_exists(output) && is_writable(output)) {
        $fp = fopen(output, 'a');
        fwrite($fp, $data . '</div><br /><hr /></div>');
        fclose($fp);
    }
    if (redirect == 1) {
        header('Location: ' . redirect_url);
    }
}
开发者ID:rjmolesa,项目名称:kunai,代码行数:26,代码来源:kunai.php

示例9: createFromGlobals

 /**
  * Instantiate request from php _SERVER variable
  * @param array server
  */
 public static function createFromGlobals()
 {
     $server = $_SERVER;
     $uriParts = parse_url($server['REQUEST_URI']);
     $uriParts['host'] = $server['SERVER_NAME'];
     $uriParts['port'] = $server['SERVER_PORT'];
     $uriParts['scheme'] = isset($server['REQUEST_SCHEME']) ? $server['REQUEST_SCHEME'] : (isset($server['HTTPS']) && $server['HTTPS'] == 'on' ? 'https' : 'http');
     if (function_exists('getallheaders')) {
         // a correct case already
         $apacheHeaders = getallheaders();
         foreach ($apacheHeaders as $header => $value) {
             $headers[$header] = array_map('trim', explode(',', $value));
         }
     } else {
         $headers = array();
         // normalize the header key
         foreach ($server as $key => $value) {
             if (substr($key, 0, 5) != 'HTTP_') {
                 continue;
             }
             $name = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
             $headers[$name] = array_map('trim', explode(',', $value));
         }
     }
     $request = new static($server['REQUEST_METHOD'], new Uri($uriParts), $headers, Stream::createFromContents(file_get_contents('php://input')), $server, $_COOKIE, UploadedFile::createFromGlobals($_FILES));
     if ($server['REQUEST_METHOD'] == 'POST' && in_array($request->getMediaType(), array('application/x-www-form-urlencoded', 'multipart/form-data'))) {
         $request->setParsedBody($_POST);
     }
     return $request;
 }
开发者ID:rosengate,项目名称:exedra,代码行数:34,代码来源:ServerRequest.php

示例10: get

 public function get()
 {
     $req_headers = getallheaders();
     $hdr_name = 'Referer';
     if (!isset($req_headers[$hdr_name])) {
         $hdr_name = 'referer';
     }
     if (!isset($req_headers[$hdr_name])) {
         return null;
     }
     $url = parse_url($req_headers[$hdr_name]);
     if (!isset($url['query'])) {
         return null;
     }
     $params = parse_str($url['query']);
     $param = 'query';
     if (!isset($params[$param])) {
         $param = 'search';
     }
     if (!isset($params[$param])) {
         $param = 'text';
     }
     if (!isset($params[$param])) {
         $param = 'etext';
     }
     if (!isset($params[$param])) {
         return null;
     }
     return urldecode($params[$param]);
 }
开发者ID:roman-rybalko,项目名称:wcs,代码行数:30,代码来源:referer.php

示例11: getJWTFromAuthHeader

 /**
  * Gets the token from Authorization header.
  *
  * @return string
  */
 protected static function getJWTFromAuthHeader()
 {
     if (env('APP_ENV') === 'testing') {
         //getallheaders method is not available in unit test mode.
         return [];
     }
     if (!function_exists('getallheaders')) {
         function getallheaders()
         {
             if (!is_array($_SERVER)) {
                 return [];
             }
             $headers = [];
             foreach ($_SERVER as $name => $value) {
                 if (substr($name, 0, 5) == 'HTTP_') {
                     $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
                 }
             }
             return $headers;
         }
     }
     $token = null;
     $headers = getallheaders();
     $authHeader = ArrayUtils::get($headers, 'Authorization');
     if (strpos($authHeader, 'Bearer') !== false) {
         $token = substr($authHeader, 7);
     }
     return $token;
 }
开发者ID:AxelKlarmann,项目名称:dreamfactory,代码行数:34,代码来源:AccessCheck.php

示例12: ClickTale_callback

function ClickTale_callback($buffer)
{
    // Implementation of new AJAX via IM method. Check headers
    $IMCache = false;
    //If 'getallheaders()' doesn't exist - create it
    if (!function_exists('getallheaders')) {
        function getallheaders()
        {
            $headers = '';
            foreach ($_SERVER as $name => $value) {
                if (substr($name, 0, 5) == 'HTTP_') {
                    $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
                }
            }
            return $headers;
        }
    }
    //Run through all headers etc...
    foreach (getallheaders() as $name => $value) {
        if (strtolower($name) == "x-clicktale-imcache" & $value == "1") {
            $IMCache = true;
        }
    }
    //Return callback
    return ClickTale_ProcessOutput($buffer, $IMCache);
}
开发者ID:Telemedellin,项目名称:tm,代码行数:26,代码来源:ClickTaleTop.php

示例13: wp_red_caps_func

function wp_red_caps_func(WP_REST_Request $request)
{
    //get headers to look for a key
    $headers = array(getallheaders());
    $api_key = $headers[0]["Apikey"];
    //api key from database
    $stored_api_key = get_option('wp_red_caps_key');
    //evaluate api key
    if ($api_key == $stored_api_key) {
        global $wpdb;
        $issue_id = $headers[0]["Issue-Id"];
        $reporter_id = $headers[0]["Reporter-Id"];
        $report_time = $headers[0]["Report_Time"];
        $lat = $headers[0]["Lat"];
        $lng = $headers[0]["Lng"];
        $type = $headers[0]["Type"];
        $business_name = $headers[0]["Business_Name"];
        $notes = $headers[0]["Notes"];
        $images = $headers[0]["Images"];
        $police_contacted = $headers[0]["Police_Contacted"];
        $table_name = $wpdb->prefix . 'red_caps_data';
        $wpdb->insert($table_name, array('id' => '', 'issue_id' => $issue_id, 'reporter_id' => $reporter_id, 'report_time' => $report_time, 'lat' => $lat, 'lng' => $lng, 'type' => $type, 'business_name' => $business_name, 'notes' => $notes, 'images' => $images, 'police_contacted' => $police_contacted));
        $output = array('incident' => 'added');
        return $output;
    } else {
        $output = "{'api_key':'no no no'}";
    }
    return $output;
}
开发者ID:sselfless,项目名称:tao-redhat,代码行数:29,代码来源:wp_red_caps_routes.php

示例14: checkHeader

 /**
  * Проверяем header уведомлений и ответов от PayQR на соответствие значению SecretKeyIn
  *
  * @param $secretKeyIn
  * @return bool
  */
 public static function checkHeader($secretKeyIn, $headers = false)
 {
     if (!PayqrConfig::$checkHeader) {
         return true;
     }
     if (!$headers) {
         if (!function_exists('getallheaders')) {
             $headers = PayqrBase::getallheaders();
         } else {
             $headers = getallheaders();
         }
     }
     if (!$headers) {
         header("HTTP/1.0 404 Not Found");
         PayqrLog::log(__FILE__ . "\n\r" . __METHOD__ . "\n\r L:" . __LINE__ . "\n\r Не удалось выполнить проверку входящего секретного ключа SecretKeyIn, отсутствует headers");
         return false;
     }
     // Проверяем соответствие пришедшего значения поля PQRSecretKey значению SecretKeyIn из конфигурации библиотеки
     if (isset($headers['PQRSecretKey']) && $headers['PQRSecretKey'] == $secretKeyIn) {
         return true;
     }
     foreach ($headers as $key => $header) {
         $headers[strtolower($key)] = $header;
     }
     if (isset($headers['pqrsecretkey']) && $headers['pqrsecretkey'] == $secretKeyIn) {
         return true;
     }
     header("HTTP/1.0 404 Not Found");
     PayqrLog::log(__FILE__ . "\n\r" . __METHOD__ . "\n\r L:" . __LINE__ . "\n\r Входящий секретный ключ из headers не совпадает с входящим ключом из файла конфигурации \n\r Текущее значение SecretKeyIn из вашего PayqrConfig.php: " . $secretKeyIn . " \n\r Содержание headers полученного уведомления от PayQR: " . print_r($headers, true));
     return false;
 }
开发者ID:payqrphpdev,项目名称:php-module,代码行数:37,代码来源:PayqrAuth.php

示例15: ajaxCustomers

 public function ajaxCustomers()
 {
     $cpage = 'customers';
     $i = Input::all();
     $arr = [];
     $arr = getallheaders();
     $count = Customer::all()->count();
     if (isset($arr['Range'])) {
         $response_array = array();
         $response_array['Accept-Ranges'] = 'items';
         $response_array['Range-Unit'] = 'items';
         $response_array['Content-Ranges'] = 'items ' . $arr['Range'] . '/' . $count;
         $arr = explode('-', $arr['Range']);
         $items = $arr[1] - $arr[0] + 1;
         $skip = $arr[0];
         $skip = $skip < 0 ? 0 : $skip;
         $c = null;
         if (isset($_GET['query']) && $_GET['query'] != '') {
             $query = $_GET['query'];
             $c = Customer::where('membership_id', 'LIKE', "%{$query}%")->orWhereRaw("concat_ws(' ',firstname,lastname) LIKE '%{$query}%'")->orWhere('firstname', 'LIKE', "%{$query}")->orWhere('lastname', 'LIKE', "%{$query}%")->skip($skip)->take($items)->get();
         } else {
             $c = Customer::skip($skip)->take($items)->get();
         }
         $response = Response::make($c, 200);
         $response->header('Content-Range', $response_array['Content-Ranges'])->header('Accept-Ranges', 'items')->header('Range-Unit', 'items')->header('Total-Items', $count)->header('Flash-Message', 'Now showing pages ' . $arr[0] . '-' . $arr[1] . ' out of ' . $count);
         return $response;
     }
     $c = Customer::all();
     $response = Response::make($c, 200);
     $response->header('Content-Ranges', 'test');
     return $response;
     /*	$c = Customer::all();
     	return $c;*/
 }
开发者ID:jonathanespanol,项目名称:FiligansHotelReservation,代码行数:34,代码来源:CustomersController.php


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