login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Snippets > HTTP-headers

HTTP-headers

Auteur: Ciantic - 08 augustus 2006 - 23:12 - Gekeurd door: Gerard - Hits: 7723 - Aantal punten: 4.33 (3 stemmen)



Met deze functie kan je alle HTTP-headers regelen door het ID van de header als parameter mee te geven.

Uitleg over de headers is hier te vinden.

Code:
  1. <?PHP
  2. /**
  3.  * HTTP Protocol defined status codes
  4.  * @param int $num
  5.  */
  6. function HTTPStatus($num) {
  7.  
  8. static $http = array (
  9. 100 => "HTTP/1.1 100 Continue",
  10. 101 => "HTTP/1.1 101 Switching Protocols",
  11. 200 => "HTTP/1.1 200 OK",
  12. 201 => "HTTP/1.1 201 Created",
  13. 202 => "HTTP/1.1 202 Accepted",
  14. 203 => "HTTP/1.1 203 Non-Authoritative Information",
  15. 204 => "HTTP/1.1 204 No Content",
  16. 205 => "HTTP/1.1 205 Reset Content",
  17. 206 => "HTTP/1.1 206 Partial Content",
  18. 300 => "HTTP/1.1 300 Multiple Choices",
  19. 301 => "HTTP/1.1 301 Moved Permanently",
  20. 302 => "HTTP/1.1 302 Found",
  21. 303 => "HTTP/1.1 303 See Other",
  22. 304 => "HTTP/1.1 304 Not Modified",
  23. 305 => "HTTP/1.1 305 Use Proxy",
  24. 307 => "HTTP/1.1 307 Temporary Redirect",
  25. 400 => "HTTP/1.1 400 Bad Request",
  26. 401 => "HTTP/1.1 401 Unauthorized",
  27. 402 => "HTTP/1.1 402 Payment Required",
  28. 403 => "HTTP/1.1 403 Forbidden",
  29. 404 => "HTTP/1.1 404 Not Found",
  30. 405 => "HTTP/1.1 405 Method Not Allowed",
  31. 406 => "HTTP/1.1 406 Not Acceptable",
  32. 407 => "HTTP/1.1 407 Proxy Authentication Required",
  33. 408 => "HTTP/1.1 408 Request Time-out",
  34. 409 => "HTTP/1.1 409 Conflict",
  35. 410 => "HTTP/1.1 410 Gone",
  36. 411 => "HTTP/1.1 411 Length Required",
  37. 412 => "HTTP/1.1 412 Precondition Failed",
  38. 413 => "HTTP/1.1 413 Request Entity Too Large",
  39. 414 => "HTTP/1.1 414 Request-URI Too Large",
  40. 415 => "HTTP/1.1 415 Unsupported Media Type",
  41. 416 => "HTTP/1.1 416 Requested range not satisfiable",
  42. 417 => "HTTP/1.1 417 Expectation Failed",
  43. 500 => "HTTP/1.1 500 Internal Server Error",
  44. 501 => "HTTP/1.1 501 Not Implemented",
  45. 502 => "HTTP/1.1 502 Bad Gateway",
  46. 503 => "HTTP/1.1 503 Service Unavailable",
  47. 504 => "HTTP/1.1 504 Gateway Time-out"
  48. );
  49.  
  50. header($http[$num]);
  51. }
  52. ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (6)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.026s