Current location: Hot Scripts Forums » Programming Languages » PHP » How can you get all request headers ?


How can you get all request headers ?

Reply
  #1 (permalink)  
Old 11-25-09, 10:10 PM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Question How can you get all request headers ?

Let's say that I have: (fsockopen or curl with show headers)

Ex of fsockopen
PHP Code:

 $fp fsockopen("www.example.com"80$errno$errstr30);

if (!
$fp) {
    echo 
"$errstr ($errno)<br />\n";
} else {
    
$out "GET /example.html HTTP/1.1\r\n";
    
$out .= "Host: www.example.com\r\n";
    
$out .= "Connection: Close\r\n\r\n";
    
fwrite($fp$out);
    while (!
feof($fp)) {
        echo 
fgets($fp128);
    }
    
fclose($fp);

The headers will be something like this:
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 26 Nov 2009 04:04:38 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Set-Cookie: iVisited=1; expires=Thu, 26-Nov-2009 05:04:38 GMT; path=/; domain=.example.com

so not all the GET headers are grabbed (the same with curl)
So I need to see all request headers, I looked around and didn't found anything.

How can I get all request header for example like the addon of firefox Live HTTP Headers ?
Is there a way or should I let this go ?
Reply With Quote
  #2 (permalink)  
Old 11-26-09, 08:20 AM
speedospeedo speedospeedo is offline
Newbie Coder
 
Join Date: May 2006
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Reply With Quote
  #3 (permalink)  
Old 11-28-09, 01:09 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Reply With Quote
  #4 (permalink)  
Old 11-29-09, 07:17 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
This isn't the same as the headers, but you can use it to get the $_GET data.

PHP: parse_url - Manual

Also - var_dump $_GET, $_POST, $_REQUEST, $_SERVER.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
community request and rating site iamthekris Script Requests 0 07-10-09 02:50 AM
Sticky Table Headers? phpdoctor JavaScript 4 02-13-09 02:27 AM
[SOLVED] PHP/MYSQL Project Need Coder dsuguy Job Offers & Assistance 2 03-25-08 05:45 PM
[SOLVED] check request system dsuguy Script Requests 7 03-21-08 05:18 PM
cURL Maximum Request? MrMMM PHP 3 11-15-06 05:37 PM


All times are GMT -5. The time now is 08:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.