2 Methods to get http_headers by url

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    2 Methods to get http_headers by url

    I don't know if its already posted in this forum such code reffering to get header methods ..

    I was searching for them , found 'em...by google, this one's are less known by codders...

    PHP Code:
    <?php 

    //2 Other Methods to get url headers 

    function byget_headers($url){print_r(get_headers($url)); /*print_r(get_headers($url, 1));*/}

    function 
    byresponse_header($url){file_get_contents($url); var_dump($http_response_header);}

    //i didn't count to cUrl because i think you all know  that  method... 

    ?>

    i recommend to use byget_headers($url); because it can group header by values for example


    [Set-Cookie] => Array
    (
    [0] => bb_lastvisit=1330471210; expires=Wed, 27-Feb-2013 23:20:10 GMT; path=/; domain=.coding-talk.com
    [1] => bb_lastactivity=0; expires=Wed, 27-Feb-2013 23:20:10 GMT; path=/; domain=.coding-talk.com
    [2] => PHPSESSID=25af1d1282d889181079f37e765ed991; path=/
    [3] => override=deleted; expires=Mon, 28-Feb-2011 23:20:09 GMT
    [4] => vbseo_loggedin=deleted; expires=Mon, 28-Feb-2011 23:20:09 GMT; path=/
    )


    That's all folks

    found them interesting so i thot they could be usefull for others to .. enjoy them
    This is ten percent luck, twenty percent skill
    Fifteen percent concentrated power of will
    Five percent pleasure, fifty percent pain

    And a hundred percent reason to remember the name!
Working...
X