Source for file get_headers.php
Documentation is available at get_headers.php
// $Id: get_headers.php,v 1.4 2007/04/17 10:09:56 arpad Exp $
define('PHP_COMPAT_GET_HEADERS_MAX_REDIRECTS', 5 );
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.get_headers
* @author Aeontech <aeontech@gmail.com>
* @author Cpurruc <cpurruc@fh-landshut.de>
* @author Aidan Lister <aidan@php.net>
* @author Arpad Ray <arpad@php.net>
* @version $Revision: 1.4 $
* @require PHP 4.0.0 (user_error)
if ($headers === false ) {
if ($format == 1 && isset ($headers['Location'])) {
$url = $headers['Location'];
for ($j = count($headers); $j--; ) {
if (preg_match('/^Location: (.*)$/i', $headers[$j], $matches)) {
return empty ($result) ? false : $result;
$port = isset ($urlinfo['port']) ? $urlinfo['port'] : 80;
$fp = fsockopen($urlinfo['host'], $port, $errno, $errstr, 30 );
$head = 'HEAD ' . (isset ($urlinfo['path']) ? $urlinfo['path'] : '/') .
(isset ($urlinfo['query']) ? '?' . $urlinfo['query'] : '') .
'Host: ' . $urlinfo['host'] . "\r\n\r\n";
list ($key) = explode(':', $header);
// First element is the HTTP header type, such as HTTP 200 OK
// It doesn't have a separate name, so check for it
Documentation generated on Mon, 11 Mar 2019 15:26:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|