public static function doHead($url, $options = array()) { $r = HttpUtils::_doGetHead($url, 'HEAD', $options); if (empty($options['follow.redirects'])) { return $r; } $maxRedirCount = isset($options['follow.maxcount']) ? $options['follow.maxcount'] : 10; $redirCount = 0; while ($r->httpCode[0] == '3' && $redirCount < $maxRedirCount) { $location = null; foreach ($r->headers as $k => $v) { if (strcasecmp($k, 'location') === 0) { $location = $v; break; } } if (!empty($location)) { $r = HttpUtils::_doGetHead($location, 'HEAD', $options); } } return $r; }