How to get HTTP Status code

PapyRef

Client
Регистрация
28.02.2012
Сообщения
70
Благодарностей
6
Баллы
0
I want to store in a file the status of loading an HTML page (HTTP status code: 404, 200, 301, ...)
Is this possible? If so can you tell me how?

Thanks for your help.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
You can use GET requests to read http headers.
 

PapyRef

Client
Регистрация
28.02.2012
Сообщения
70
Благодарностей
6
Баллы
0
Thank for your help rostonix but I have some difficulties to do it.

I use GET requests with Headers and content set, Put to variable HTMLPage.
I do this because sometimes there are sites with a good HTTP status code (200) but site is not available (eg:Temporarily Unavailable, Bandwidth Limit Exceeded, ...)
I test it with regex :
(?i:Service Temporarily Unavailable|Bandwidth Limit Exceeded))
but I have not found how to retrieve the http status code with GET requests.

Can you explain in more detail?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113

PapyRef

Client
Регистрация
28.02.2012
Сообщения
70
Благодарностей
6
Баллы
0
Ok rostonix.

I make this Regex to get HTTP Status code
Код:
(?<=HTTP/[0-9]\.[0-9]\ )[0-9]+
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)