Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Jak Zczytac Nagłowki HTTP (nie da sie)
-gox-
post
Post #1





Goście







Chcialbym zczytac naglowki HTTP (request)

niestety do uzycia http_get_request_headers()l potrzebna jest biblioteka, ktorej zaden z moich hostingow nie ma,

w komentarzach na manualu, ktos wspomina, ze mozna zrobic tak:

$body = @file_get_contents('php://input');

niestety rowniez nie dziala...

Ktos ma jakis pomysl?

Arcyserdecznie dziekuje za pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
-gox-
post
Post #2





Goście







getallheaders();

tez niestety nie istnieje na tym hostingu :/
Go to the top of the page
+Quote Post
-gox-
post
Post #3





Goście







Do stu tysiecy srednikow, alem ja durny...

wszystkie naglowki sa w $_SERVER i maja przewdrostek HTTP_ ;p
Go to the top of the page
+Quote Post
-gox-
post
Post #4





Goście







urodzilem cos takiego:

  1. <?php
  2. if ( ! function_exists('getallheaders')) {
  3.    function getallheaders() {
  4.        $http_headers = array();
  5.        foreach ( $_SERVER as $key=>$val) {
  6.            $key = strtolower($key);
  7.            $key = trim($key);
  8.            if ( substr($key, 0, 5) == 'http_' ) {
  9.                $key = substr($key, 5);
  10.                $key = str_replace('_', ' ', $key);
  11.                $key = ucwords($key);
  12.                $key = str_replace(' ', '-', $key);
  13.                $http_headers[$key] = $val;
  14.            }
  15.        }
  16.        return $http_headers;
  17.    }
  18. }
  19. ?>


I dziala smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 10:40