Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    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?

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    333
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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.


  •  

    LinkBacks (?)

    1. 08-22-2014, 03:29 PM

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •