Re: HTTP Request, character encoding and fsockopen



Hi,

You could try using HTTP/1.0 or simply leaving off the HTTP version.

HTTP/1.1 clients must be able to handle "chunked transfer coding",
which is the encoding you're seeing. Each segment is preceded by it's
size in hex.

Details:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1

Peace,
John Peters

On Jan 19, 3:18 am, Vladimir Ghetau <vladi...@xxxxxxxxxxxxxxxxx>
wrote:
Hi guys,

This is a weird problem, and I'm not sure if I got it right.

Just a practical example, that will describe my problem:

I'm connecting to google.com host on port 80 using fsock open, and I
send a regular GET header without any specific HTTP headers regarding
the type of encoding accepted, cookies, accepted charset, conditional
headers etc

What happens, is after sending the headers to this stream opened using
fsockopen, I start grabbing the headers, and then, comes the body of
the web page, everything seems logic until this point.

The problem is, just after the headers are received, the body of the
page, contains few odd alphanumeric values , about 4 elements in
length, and it seems it's a hexa value. e.g.. 2A, or two values
maybe: 8c9d... then comes the regular HTML code of the page if any.

At the end of the grabbed content, there's also one of these
alphanumeric groups, or a "0" (zero).

For some reason I tend to believe the characters right after the
headers are sent are used by browsers to identify the type of the
encoding of the stream? e.g. bytes that decide that my page is going
to come as UTF-8 encoding?

Anyways, the problem is, how to make sure I get the page right, and
why the file_Get_contents (url_goes_here) doesn't grab those
alphanumeric characters, considering they're stripping the returned
headers of the request already.

I am still thinking it's some sort of "stream's first byte" that
informs the app about the encoding of the content, but I'm here to
hear your input and solution on this.

Thank you,

Vladimir Ghetau

http://www.Vladimirated.com/

.



Relevant Pages

  • Re: Marinetti casper - How do I use it?
    ... The latter requires encoding and decoding the last I looked. ... If you send data without those headers, ... via HTTP anymore. ... You mentioned MIME in another post but that has absolutely nothing to do ...
    (comp.sys.apple2)
  • Re: Marinetti casper - How do I use it?
    ... The HTTP protocol also supports encoding, ... Anything sent via HTTP will have HTTP headers. ... You mentioned MIME in another post but that has absolutely nothing to ...
    (comp.sys.apple2)
  • Re: Corrupted Subject and From header in Amazon.co.uk mail
    ... It looks as if they're encoding the subject text (or rather, ... only US-ASCII characters and so there was no need to encode it. ... and I wasn't aware that headers like Subject and From ... you and I can't exactly see how to achieve a security compromise, ...
    (comp.mail.pine)
  • Re: The word "rasismi" in Finnish (was Re: unnatural languages)
    ... as the default encoding for this ng, but perhaps that was a mistake. ... everyone using UTF-8 has an appropriate line in their headers, ... explicit encoding header line if I am in a default mode. ... usually change the View/Encoding to Unicode ...
    (sci.lang)
  • Re: problems with messages FROM GroupWise users
    ... The issue is in the encoding, not the decoding (Groupwise) ... with all the internet headers in the body of the message and the ... My users are running Outlook 2003, and we have Exchange 2003. ... patch breaking some of the base64 encoding on the Exchange side. ...
    (microsoft.public.outlook)

Loading