|
Posted by NurAzije on 10/21/05 18:00
I am trying to make afunction to get information from one file and
print it or put it in an array, the problem in headers I can't figure
that it is giving me this:
********
HTTP/1.1 400 Bad Request Date: Fri, 21 Oct 2005 14:48:06 GMT Server:
Apache Connection: close Content-Type: text/html; charset=iso-8859-1
Bad Request
Your browser sent a request that this server could not understand.
Request header field is missing colon separator.
Host=www.imtec.ba
********
My code is :
*********
<?
function getFile($host,$file)
{
$request="GET $file HTTP/1.0\r\n"; // This is the path part of the
link
$request.="Host=$host\r\n\r\n"; // This is the server part of the
link
// Now let's try connecting:
$fp=fsockopen($host, 80, $errno, $errstr, 30);
// Let's see if we made it
if (!$fp)
{
return(false);
}
else
{
// If we made it, let's send the request:
fputs($fp, $request);
while (!feof($fp))
{
$response.=fgets($fp, 128);
}
fclose($fp);
return($response);
}
}
echo getFile("www.imtec.ba","index.php");
?>
*********
Any help, what is wrong..
Thank you
Navigation:
[Reply to this message]
|