T
T
theSever2016-09-03 23:41:09
Computer networks
theSever, 2016-09-03 23:41:09

Determine if a site page exists with a get request?

In short, send a get request:

GET /chek-list-napisaniya-zagolovkov.html HTTP/1.0\n
Host: mxmf.ru\n
Accept-Encoding: gzip, deflate\n
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)\n
Connection: Keep-Alive\n\n
Connection: close\n\n

And I get a response:
HTTP/1.1 404 Not Found
Date: Sat, 03 Sep 2016 20:39:21 GMT
Server: Apache
Content-Length: 353
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /chek-list-napisaniya-zagolovkov.html was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

When requesting the main page, everything is fine and the response comes:
HTTP/1.1 200 OK
Date: Sat, 03 Sep 2016 20:40:32 GMT
Server: Apache
Last-Modified: Sun, 25 Jan 2015 17:18:46 GMT
ETag: "4a1659d-2c-50d7d36dbc980"
Accept-Ranges: bytes
Content-Length: 44
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html

<html>Apache is functioning normally</html>

I don't understand what's wrong with accessing pages.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2016-09-04
@theSever

The answer "Apache is functioning normally" instead of the main page of the site hints at the fact that this request is not processed as expected.
Checked - everything works:

Connected to mxmf.ru.
Escape character is '^]'.
GET /chek-list-napisaniya-zagolovkov.html HTTP/1.0
Host: mxmf.ru
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)

HTTP/1.1 200 OK
Date: Sat, 03 Sep 2016 21:23:38 GMT
Server: Apache
Link: <http://mxmf.ru/?p=914>; rel=shortlink
Set-Cookie: antibot-hostia=true; path=/; domain=mxmf.ru; expires=Sun, 04-Sep-2016 21:23:38 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 26490
Connection: close
Content-Type: text/html; charset=UTF-8
...

Therefore - check the IP address where you are connecting.
Or DNS has not been updated (if you connect by domain name) or the address is incorrect.
Or show the full code - maybe there is another error in the request.

A
Alexander, 2016-09-04
@NeiroNx

According to the response code, of course: 200 everything is fine, 404 - not found.

M
Maxim, 2016-09-04
@m77x

I check if the page exists with this line:

<? if (@fopen("http://адрес_страницы", "r")) { echo 'Грузится как миленькая';} else { echo 'косяк какой-то';}; ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question