CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   PHP + Curl to simulate live http headers? (http://www.codingforums.com/showthread.php?t=284984)

sorlaker 12-29-2012 03:27 AM

PHP + Curl to simulate live http headers?
 
Is there a way that i can check live http headers exactly as firefox addon (Live http headers) sees?

Redcoder 12-29-2012 08:18 AM

Try this get_headers():

PHP Code:

$url 'http://www.codingforums.com';

echo 
"<pre>";

print_r(get_headers($url1));

echo 
"</pre>"


That will output something like:

Code:


Array
(
    [0] => HTTP/1.1 200 OK
    [Date] => Sat, 29 Dec 2012 08:19:04 GMT
    [Server] => Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_bwlimited/1.4 PHP/5.2.6
    [X-Powered-By] => PHP/5.2.6
    [Set-Cookie] => Array
        (
            [0] => bbsessionhash=cb9550ca1e0e70135402c4cbf73e736b; path=/; HttpOnly
            [1] => bblastvisit=1356769144; expires=Sun, 29-Dec-2013 08:19:04 GMT; path=/
            [2] => bblastactivity=0; expires=Sun, 29-Dec-2013 08:19:04 GMT; path=/
        )

    [Expires] => 0
    [Cache-Control] => private, post-check=0, pre-check=0, max-age=0
    [Pragma] => no-cache
    [X-UA-Compatible] => IE=7
    [Connection] => close
    [Content-Type] => text/html; charset=ISO-8859-1
)

If you want to spoof stuff like UserAgent, that can be easily done using cURL.


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.