Corsi on-line
Chiudi
Newsletter:
  • Seguici su Facebook
  • Seguici su Twitter
  • Seguici su Google+
  • Seguici via RSS
  • Seguici col tuo Smartphone

get_headers

La funzione get_headers effettua il recupero di tutti gli headers restituiti dal server a seguito di una chiamata HTTP. Vediamo un esempio:

print_r(get_headers("http://www.google.it"));
restituisce una array come questa:
Array
(
    [0] => HTTP/1.0 200 OK
    [1] => Cache-Control: private, max-age=0
    [2] => Date: Thu, 18 Sep 2008 23:33:16 GMT
    [3] => Expires: -1
    [4] => Content-Type: text/html; charset=ISO-8859-1
    [5] => Set-Cookie: PREF=ID=5ed27189f661d029:TM=1221780796:LM=1221780796:S=I0idTwSeHmzzm72R; expires=Sat, 18-Sep-2010 23:33:16 GMT; path=/; domain=.google.it
    [6] => Server: gws
    [7] => Connection: Close
)
La funzione in oggetto ammette anche un secondo argomento (facoltativo) format. Vediamo un esempio con il parametro format settato su 1:
print_r(get_headers("http://www.google.it", 1));
L'array restituita è la seguente:
Array
(
    [0] => HTTP/1.0 200 OK
    [Cache-Control] => private, max-age=0
    [Date] => Thu, 18 Sep 2008 23:34:46 GMT
    [Expires] => -1
    [Content-Type] => text/html; charset=ISO-8859-1
    [Set-Cookie] => PREF=ID=00686f5402c73192:TM=1221780885:LM=1221780885:S=LaAYrpUJHJlb53xi; expires=Sat, 18-Sep-2010 23:34:45 GMT; path=/; domain=.google.it
    [Server] => gws
    [Connection] => Close
)

Corsi
Corso LinuxCorso Linux
Guida completa al sistema open-source. A partire da 39 €.
Corso MySQLCorso MySQL
Gestione del database open-source. A partire da 49 €.
Corso PHPCorso PHP
Corso completo per la creazione di siti Web dinamici. A partire da 49 €.
Vedi anche...
Annunci

Mr.Webmaster

Pubblicità
Chi Siamo
Contattaci
Collabora
Note Legali
© 2003 - 2012 Mr.Webmaster - Il portale dei Webmaster Italiani - Tutti i diritti riservati | Powered by IKIweb Internet Media S.r.l. - PIVA 02848390122