1

Доброго времени суток.
Есть задача:
1) залогиниться на сайте из sh скрипта через wget
2) выставить 5 селектов в определенное положение и кликнуть по submit button.
Данные передаются POST. С первой задачей справились успешно:

wget --keep-session-cookies --save-cookies cookies.txt --post-data 'username=$USER&password=$PASS&submit=1' http://url.ru/admin/login.php

Куки сохраняются в файл cookies.txt , содержимое файла:

# HTTP cookie file.
# Generated by Wget on 2011-01-27 12:23:07.
# Edit at your own risk.

url.ru     FALSE   /       FALSE   0       ps_sess_id      fd6c1bcabaf36e6eee8c9785afbe474a

Далее пытаемся зайти на нужную страницу и выполнить необходимые действия, используя сохранённые куки:

wget --load-cookies cookies.txt --post-data 'player_profiles=1&player_aliases=1&player_bans=1&clan_profiles=1&users=1&submit=1' -p http://url.ru/admin/reset.php

В ответ получаем:

--12:26:37--  http://url.ru/admin/reset.php
           => `url.ru/admin/reset.php'
Resolving url.ru... 10.5.255.20
Connecting to url.ru|10.5.255.20|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: /admin/login.php?ref=%2Fgames%2Fcs_monthly%2Fadmin%2Freset.php [following]
--12:26:37--  http://url.ru/admin/login.php?ref=%2Fgames%2Fcs_monthly%2Fadmin%2Freset.php
           => `url.ru/admin/login.php?ref=%2Fgames%2Fcs_monthly%2Fadmin%2Freset.php'
Connecting to url.ru|10.5.255.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3,706 (3.6K) [text/html]

100%[=================================================================================================================>] 3,706         --.--K/s

12:26:37 (190.23 MB/s) - `url.ru/admin/login.php?ref=%2Fgames%2Fcs_monthly%2Fadmin%2Freset.php' saved [3706/3706]

Loading robots.txt; please ignore errors.
--12:26:37--  http://url.ru/robots.txt
           => `url.ru/robots.txt'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 302 Found
Location: http://core.url.ru/errors/404/ [following]
--12:26:37--  http://core.url.ru/errors/404/
           => `core.url.ru/errors/404/index.html'
Resolving core.url.ru... 190.238.131.200
Connecting to core.url.ru|190.238.131.200|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

    [ <=>                                                                                                              ] 1,330         --.--K/s

12:26:37 (174.61 MB/s) - `core.url.ru/errors/404/index.html' saved [1330]

--12:26:37--  http://url.ru/admin/themes/acp/css/overall.css
           => `url.ru/admin/themes/acp/css/overall.css'
Connecting to url.ru|10.5.255.20|:80... connected.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:37 ERROR 405: Not Allowed.

--12:26:37--  http://url.ru/admin/themes/acp/css/content.css
           => `url.ru/admin/themes/acp/css/content.css'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:37 ERROR 405: Not Allowed.

--12:26:37--  http://url.ru/admin/themes/acp/css/forms.css
           => `url.ru/admin/themes/acp/css/forms.css'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:37 ERROR 405: Not Allowed.

--12:26:37--  http://url.ru/admin/themes/acp/js/jquery.js
           => `url.ru/admin/themes/acp/js/jquery.js'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:37 ERROR 405: Not Allowed.

--12:26:37--  http://url.ru/admin/themes/acp/js/overall.js
           => `url.ru/admin/themes/acp/js/overall.js'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:37 ERROR 405: Not Allowed.

--12:26:37--  http://url.ru/admin/themes/acp/js/forms.js
           => `url.ru/admin/themes/acp/js/forms.js'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:38 ERROR 405: Not Allowed.

--12:26:38--  http://url.ru/admin/themes/acp/js/login.js
           => `url.ru/admin/themes/acp/js/login.js'
Reusing existing connection to url.ru:80.
HTTP request sent, awaiting response... 405 Not Allowed
12:26:38 ERROR 405: Not Allowed.

Исходя из ошибок вида ERROR 405: Not Allowed возникает ощущение что wget не считывает/не передаёт сохранённые куки из файла cookies.txt
Кто нибудь сталкивался ? Какие есть идеи? В каком направлении рыть?

2

Shtirlitc, http://forum.drbatty.ru/viewtopic.php?f=77&t=5215
не?

Карусель разнесло по цепочке за час
Всех известий — конец
Да, весна началась!
(всё к лицу подлецу, как родному отцу, не рассказывай, батя, и так всё пройдёт)

3

drBatty пишет:

Shtirlitc, http://forum.drbatty.ru/viewtopic.php?f=77&t=5215
не?

Похоже на то что нужно, спасибо. Проверяю.

4

Shtirlitc пишет:

Проверяю.

это лишнее. УМВР bx

Карусель разнесло по цепочке за час
Всех известий — конец
Да, весна началась!
(всё к лицу подлецу, как родному отцу, не рассказывай, батя, и так всё пройдёт)

5

drBatty
Работает smile
Ещё раз спасибо!