This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import socket | |
# Данные для подключения к серверу | |
HOST = "127.0.0.1" | |
PORT = 8080 | |
# Статусы ответа сервера | |
STATUS = { | |
200 : b"HTTP/1.1 200 OK\nContent-Type: text/html; charset=utf-8\n\n\n", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Исходный код: | |
<html> | |
<head> | |
<title>Реализация сокетов на PHP</title> | |
</head> | |
<body> | |
<pre> | |
<?php | |
$host = "kontur.ru"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Файл с формой form.html: | |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Задание 4</title> | |
</head> | |
<body> | |
<form name="Task 1.4" action="http://httpbin.org/post" method="POST" и enctype="multipart/form-data"> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Запрос № 1: | |
$ telnet httpbin.org 80 | |
Trying 54.243.67.94... | |
Connected to httpbin.org. | |
Escape character is '^]'. | |
GET /ip HTTP/1.1 | |
Host: httpbin.org | |
Accept: */* | |
Ответ № 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Запрос: | |
$ telnet kontur.ru 80 | |
Trying 46.17.203.102... | |
Connected to kontur.ru. | |
Escape character is '^]'. | |
GET /products/actions HTTP/1.1 | |
Host: kontur.ru | |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5 | |
Accept: text/html | |
Connection: close |
NewerOlder