# Вводные данные
1. Пустая очередь
/var/www/1c2i/safe/service-interface.yaml
```
---
commands_queque: ~
...
```
2. Пустая база результатов
/var/www/1c2i/safe/service-output.yaml
```
---
...
```
3. Ни один экземпляр скрипта не запущен.
В консоли сервера:
```
root@InstaApi:/var/www/1c2i# screen -list
No Sockets found in /run/screen/S-root.
```
# Последовательность действий
1. Запускаю скрипт
```
cd /var/www/1c2i
screen -LS "1c2i" php index.php
```
Дальше нажимаю CTRL + A, D для открепления screen.
2. Посылаю запрос (raw)
```
GET http://45.67.56.74/1c2i-pass.php HTTP/1.1
Host: 45.67.56.74
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
1c2i_password: pHzYCy9q5Ugh2iaBnu4ZF3MSb6xVfTts
1c2i_command: login
1c2i_argument_login: taggert_insta
1c2i_argument_password: 95b72d59
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
```
3. Получаю ответ (raw)
```
HTTP/1.1 200 OK
Date: Sat, 14 Sep 2019 15:44:04 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Length: 13
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
5d7d0ac4bd326
```
4. Жду секунд 5, посылаю запрос (raw)
```
GET http://45.67.56.74/1c2i-result.php HTTP/1.1
Host: 45.67.56.74
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
1c2i_password: pHzYCy9q5Ugh2iaBnu4ZF3MSb6xVfTts
1c2i_uid: 5d7d0ac4bd326
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
```
5. Ответ (raw)
```
HTTP/1.1 200 OK
Date: Sat, 14 Sep 2019 15:46:38 GMT
Server: Apache/2.4.29 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 1697
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
{"status":0,"data":"InstagramAPI\\Exception\\ChallengeRequiredException: InstagramAPI\\Response\\LoginResponse: Challenge required. in \/var\/www\/1c2i\/composer-libs\/mgp25\/instagram-php\/src\/Exception\/ServerMessageThrower.php:190\nStack trace:\n#0 \/var\/www\/1c2i\/composer-libs\/mgp25\/instagram-php\/src\/Client.php(579): InstagramAPI\\Exception\\ServerMessageThrower::autoThrow('InstagramAPI\\\\Re...', 'challenge_requi...', Object(InstagramAPI\\Response\\LoginResponse), Object(GuzzleHttp\\Psr7\\Response))\n#1 \/var\/www\/1c2i\/composer-libs\/mgp25\/instagram-php\/src\/Request.php(832): InstagramAPI\\Client->mapServerResponse(Object(InstagramAPI\\Response\\LoginResponse), '{\"message\": \"ch...', Object(GuzzleHttp\\Psr7\\Response))\n#2 \/var\/www\/1c2i\/composer-libs\/mgp25\/instagram-php\/src\/Instagram.php(507): InstagramAPI\\Request->getResponse(Object(InstagramAPI\\Response\\LoginResponse))\n#3 \/var\/www\/1c2i\/composer-libs\/mgp25\/instagram-php\/src\/Instagram.php(453): InstagramAPI\\Instagram->_login('taggert_insta', '95b72d59', false, 1800)\n#4 \/var\/www\/1c2i\/php\/1c2i\/InstagramManager.php(69): InstagramAPI\\Instagram->login('taggert_insta', '95b72d59')\n#5 \/var\/www\/1c2i\/php\/1c2i\/Application.php(144): _1c2i\\InstagramManager->addLogin(Array, '5d7d0ac4bd326')\n#6 [internal function]: _1c2i\\Application->_1c2i\\{closure}()\n#7 \/var\/www\/1c2i\/php\/1c2i\/Service\/Task.php(103): call_user_func(Object(Closure))\n#8 \/var\/www\/1c2i\/php\/1c2i\/Service.php(45): _1c2i\\Service\\Task->exec()\n#9 \/var\/www\/1c2i\/php\/1c2i\/Application.php(203): _1c2i\\Service->loop()\n#10 \/var\/www\/1c2i\/index.php(14): _1c2i\\Application->entryPoint()\n#11 {main}"}
```