2 Methods to get http_headers by url

Started on the old forum in February 2012 · view the original in the archive · old links redirect here

No replies · 1,755 views · started 14 years ago · 1 min read

just_m3. Developer · 199 posts #1

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 

//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!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close