WH-Tim
01/05/07, 21:52
Onderstaande code wilt helaas al anderhalf uur niet werken. $parts is een array bestaande uit [0] = www.eenbestaandedomeinnaam.nl en [1] = index.html . De array heb ik al hardcoded gedaan, en ook de $parts al eens verwijderd en hardcoded.
<?php $sock = fsockopen($parts[0], "80", $errno, $errstr, 30);
if($sock)
{
fwrite($sock, "HEAD /".$parts[1]." HTTP/1.0\r\n");
fwrite($sock, "Connection: close\r\n\r\n");
while(!feof($sock))
{
$headers .= fgets($sock);
}
echo $headers;
}
?>
Als ik http 1.0 gebruik krijg ik constant deze melding, hoe ik het ook schrijf of aanpas:
HTTP/1.1 302 Found
Date: Tue, 01 May 2007 19:50:51 GMT
Server: Apache
Location: http:///
Connection: close
Content-Type: text/html; charset=iso-8859-1
met http 1.1 krijg ik constant deze melding:
HTTP/1.1 400 Bad Request
Date: Tue, 01 May 2007 19:54:00 GMT
Server: Apache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Wat ik wil is gewoon met PHP4 de header uitlezen, zodat ik kan controleren op Content-Type. Iemand voor mij de oplossing of een schop in de richting?
Ik ben er al achter dat het iets met Apache's VirtualHosts te maken heeft..
<?php $sock = fsockopen($parts[0], "80", $errno, $errstr, 30);
if($sock)
{
fwrite($sock, "HEAD /".$parts[1]." HTTP/1.0\r\n");
fwrite($sock, "Connection: close\r\n\r\n");
while(!feof($sock))
{
$headers .= fgets($sock);
}
echo $headers;
}
?>
Als ik http 1.0 gebruik krijg ik constant deze melding, hoe ik het ook schrijf of aanpas:
HTTP/1.1 302 Found
Date: Tue, 01 May 2007 19:50:51 GMT
Server: Apache
Location: http:///
Connection: close
Content-Type: text/html; charset=iso-8859-1
met http 1.1 krijg ik constant deze melding:
HTTP/1.1 400 Bad Request
Date: Tue, 01 May 2007 19:54:00 GMT
Server: Apache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Wat ik wil is gewoon met PHP4 de header uitlezen, zodat ik kan controleren op Content-Type. Iemand voor mij de oplossing of een schop in de richting?
Ik ben er al achter dat het iets met Apache's VirtualHosts te maken heeft..