function lc_GetHeaders in Link checker 5
1 call to lc_GetHeaders()
- lc_GetResponse in ./linkchecker.module
File
- ./linkchecker.module, line 472
- This module periodically check html links referenced by drupal nodes
Developed and maintained by Marek Tichy, marek@ecn.cz
Code
function lc_GetHeaders($url) {
$info = @parse_url($url);
$fp = @fsockopen($info["host"], 80, $errno, $errstr, variable_get('linkchecker_socket_timeout', 3));
if (!$fp) {
return false;
}
else {
if (empty($info["path"])) {
$info["path"] = "/";
}
$query = "";
if (isset($info["query"])) {
$query = "?" . $info["query"] . "";
}
$info["path"] = str_replace(" ", "%20", $info["path"]);
$out = "HEAD " . $info["path"] . "" . $query . " HTTP/1.0\r\n";
$out .= "Host: " . $info['host'] . "\r\n";
$out .= "Connection: close \r\n";
$out .= "Accept-language: en-us;q=0.7,en;q=0.3 \r\n";
$out .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$out .= "Accept-charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7";
$out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.5) Gecko/20061201 Firefox/2.0.0.5 (Ubuntu-feisty) \r\n\r\n";
d_("Headers sent: {$out}");
fwrite($fp, $out);
$html = '';
$html .= fread($fp, 8192);
fclose($fp);
}
return $html;
}