Forum Moderators: coopster

Message Too Old, No Replies

What is 6f and 0 in the http response I got

fsockopen http response error 0 zero at the end

         

suman haldar

1:13 am on Mar 19, 2006 (gmt 0)

10+ Year Member



Dear Friends,

I have written a script which will connect to a remote page then submit form data to that file and after that it will get the response.
Here is a code snippet of http response code


while(!feof($fp))
{
$http_response.=fgets($fp,1024);
}
echo "The server response is<br>";
$response = htmlspecialchars($http_response);
echo nl2br($response);
fclose($fp);

The output it gives from the response is something like this


The server response is
HTTP/1.1 200 OK
Date: Sun, 19 Mar 2006 00:52:11 GMT
Server: Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.1 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.1
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

6f
<html>
<head>
<title>
</title>
</head>
<body>
This is Test<br>
Webmaster Suman Haldar
</body>
</html>
0

but actually test.php should return this


The server response is
HTTP/1.1 200 OK
Date: Sun, 19 Mar 2006 00:52:11 GMT
Server: Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.1 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.1
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
<html>
<head>
<title>
</title>
</head>
<body>
This is Test<br>
Webmaster Suman Haldar
</body>
</html>

I checked the response of test.php using a HTTP Sniffer httplook. And the Response is like the below one.
Then why do I get this 6f at first of the HTTP Response and 0 at the last of the HTTP response.
I wish some Guru can help me on understanding the HTTP response i m getting using the Code mentioned here. what are those? If there is any reference available that will be gr8 for me .
Thanks in advance.

[edited by: coopster at 1:36 pm (utc) on Mar. 19, 2006]
[edit reason] closed the quotation [/edit]

coopster

12:07 am on Mar 21, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What happens if you just dump the variable out instead of using the htmlspecialchars and nl2br functions? Does it look any different?

suman haldar

12:54 pm on Mar 22, 2006 (gmt 0)

10+ Year Member



Dear Friends,
I have found the answer of those 6f and 0. 6f is the hexadecimal representation of the decimal 111 there are 111 character in the chunked output. This is the standard of outputing the chunked data which starts with the content length and ends with a 0.

Suman Haldar