HTTP::head

HTTP::head -- sends a "HEAD" command

Synopsis

require_once 'HTTP.php';

array HTTP::head (string $url)

Description

Sends a "HEAD" HTTP command to a server and returns the headers in an associative array.

Parameter

Return value

array - an array containing the header lines or a PEAR_Error.

Example output:
Array
(
 [response_code] => 200          // The HTTP response code
 [response] => HTTP/1.1 200 OK   // The full HTTP response string
 [Date] => Fri, 11 Jan 2002 01:41:44 GMT
 [Server] => Apache/1.3.20 (Unix) PHP/4.1.1
 [X-Powered-By] => PHP/4.1.1
 [Connection] => close
 [Content-Type] => text/html
)

Throws

Table 26-1. Possible PEAR_Error values

Error codeError messageReasonSolution
NULL "HTTP::head Error $errstr ($erno)" Connection to server failed Check connectivity of your host and the given URL in $url

Note

This function can be called statically