How to get HTTP Error code from WWW class? ;)

Hi all

How to get HTTP Error code from WWW class? I mean 200, 302, 404 end so on (RFC HTTP/1.1: Status Code Definitions )

When I try to get my non exists siteobject throug wget -H -S http://www.domain.ru/nonexists.file
i have got this responce:

  HTTP/1.1 404 Not Found
  Date: Fri, 11 Feb 2011 11:24:32 GMT
  Server: Apache/2.2.17 (CentOS)
  Content-Length: 309
  Connection: close
  Content-Type: text/html; charset=iso-8859-1

but when I use WWW class for this operation all I got from WWW.responseHeaders.Keys
is

Date: Fri, 11 Feb 2011 11:24:32 GMT
Server: Apache/2.2.17 (CentOS)
Content-Length: 309
Connection: close
Content-Type: text/html; charset=iso-8859-1

so where is first string with error code? I mean “HTTP/1.1 404 Not Found” ??? :face_with_spiral_eyes:

Also, nothing contents in WWW.error

its in www.text as any kind of “HTTP error” that lead to user visible pages in browsers (500, 403, 404)

Does this mean, that I cant get this information from headers? I think so.
I have sence of this error already in dirty approach: I get it from small file size combined with “404 Not Found” in response contents, but I wished to make eror sense more stricted and generalized if it possible.

Thats basically what it means yes.

My solution is

  1. Check error
  2. if error 0, then check the response for validity (which is simple as our responses are always structured messages so json / xml). if parsing throws exception scan for error code, if thats of interest at all, otherwise just let the user know that the operation isn’t possible at the time. (the majority of these errors that would end in there should never happen with software you still support cause you know when you moved a page and if the server does not respond, you also won’t get a 404 etc)