POST браузером

agcentory240

Client
Регистрация
09.09.2014
Сообщения
123
Реакции
15
Баллы
18
Форумчане, подскажите пожалуйста, как можно выполнить POST запрос браузером, не нажимая кнопок?
 
  • Оценить
Реакции: agcentory240
ответ от сюда https://forum.antichat.ru/threads/424931/

data:text/html,<form action=http://site.com/ method=post><input name=a></form>

p.s.: это писать в адресную строку

данный способ не работает в зенке
браузером точно также как и обычно
просто составьте полную ссылку со всеми параметрами.
 
а Вы каким способом делаете?
Например так можно
Код:
Развернуть Свернуть Копировать
http://www.site.com/wp-admin/admin-ajax.php?data%5Bwp-refresh-post-lock%5D%5Bpost_id%5D=3172&data%5Bwp-refresh-post-nonces%5D%5Bpost_id%5D=3172&interval=15&_nonce=406df3a&action=heartbeat&screen_id=product&has_focus=true
но мне проще без браузера
 
Например так можно
Код:
Развернуть Свернуть Копировать
http://www.site.com/wp-admin/admin-ajax.php?data%5Bwp-refresh-post-lock%5D%5Bpost_id%5D=3172&data%5Bwp-refresh-post-nonces%5D%5Bpost_id%5D=3172&interval=15&_nonce=406df3a&action=heartbeat&screen_id=product&has_focus=true
но мне проще без браузера
я думал это гет запрос. как через такой запрос передать нажатие кнопки, если скрипт потом принимает данные из пост массива, если честно, не вникал в написание на пост/гет запросах, знаю только что файл *.php принимает данные, которые передаются либо массивом гет (из строки браузера через параметры например) либо массивом пост, данные которые вроде как передать через строку браузера нельзя, разве что методом data:text/html,<form action=http://site.com/ method=post><input name=a></form> , правда при тесте на одном форуме ничего не получилось, там ещё какие-то числобуквенный параметр передавался непонятный, в итоге после исполнения запроса генерировалась форма с кнопкой и полями ввода, а не действие, которое должно было быть в случае заполнения и отправки формы нажатием кнопки в скрипт action
а без браузера как делать правильно (например получить ответ от скрипта, принимающего данные через пост метод)?
 
У меня для этого есть отдельный курс про работу на пост гет.
Индивидуально вам покажу как с этим разбираться.
Мне бы реально такой курс не помешал узнать поподробнее о post/get запросах, вплоть до самых мелочей. Поделишься ссылочкой или у тебя этот курс платный?
 
Мне бы реально такой курс не помешал узнать поподробнее о post/get запросах, вплоть до самых мелочей. Поделишься ссылочкой или у тебя этот курс платный?
конечно платный потому что бесплатно 2-3 часа выделять на каждого сложно
 
конечно платный потому что бесплатно 2-3 часа выделять на каждого сложно
Не ... мне устный курс вообще не сдался, мне бы какое-нибудь видео на 20+ продвинутых уроков по post/get или книгу на страниц 100+
 
Если кому интересно, то создаем блок яваскрипта, говорим ему выполнятся на странице, находим на нем какой нибудь блок для привязки, например form_sample, а далее делаем примерно так
HTML:
Развернуть Свернуть Копировать
// Fetching HTML Elements in Variables by ID.
var x = document.getElementById("form_sample");
var createform = document.createElement('form'); // Create New Element Form
createform.setAttribute("action", ""); // Setting Action Attribute on Form
createform.setAttribute("method", "post"); // Setting Method Attribute on Form
x.appendChild(createform);

var heading = document.createElement('h2'); // Heading of Form
heading.innerHTML = "Contact Form ";
createform.appendChild(heading);

var line = document.createElement('hr'); // Giving Horizontal Row After Heading
createform.appendChild(line);

var linebreak = document.createElement('br');
createform.appendChild(linebreak);

var namelabel = document.createElement('label'); // Create Label for Name Field
namelabel.innerHTML = "Your Name : "; // Set Field Labels
createform.appendChild(namelabel);

var inputelement = document.createElement('input'); // Create Input Field for Name
inputelement.setAttribute("type", "text");
inputelement.setAttribute("name", "dname");
createform.appendChild(inputelement);

var linebreak = document.createElement('br');
createform.appendChild(linebreak);

var emaillabel = document.createElement('label'); // Create Label for E-mail Field
emaillabel.innerHTML = "Your Email : ";
createform.appendChild(emaillabel);

var emailelement = document.createElement('input'); // Create Input Field for E-mail
emailelement.setAttribute("type", "text");
emailelement.setAttribute("name", "demail");
createform.appendChild(emailelement);

var emailbreak = document.createElement('br');
createform.appendChild(emailbreak);

var messagelabel = document.createElement('label'); // Append Textarea
messagelabel.innerHTML = "Your Message : ";
createform.appendChild(messagelabel);

var texareaelement = document.createElement('textarea');
texareaelement.setAttribute("name", "dmessage");
createform.appendChild(texareaelement);

var messagebreak = document.createElement('br');
createform.appendChild(messagebreak);

var submitelement = document.createElement('input'); // Append Submit Button
submitelement.setAttribute("type", "submit");
submitelement.setAttribute("name", "dsubmit");
submitelement.setAttribute("value", "Submit");
createform.appendChild(submitelement);

В конце делаем сабмит.

С использованием джиквери еще проще, но там ее надо подгружать и т.д.

Взято тут https://www.formget.com/javascript-contact-form/
 
Если кому интересно, то создаем блок яваскрипта, говорим ему выполнятся на странице, находим на нем какой нибудь блок для привязки, например form_sample, а далее делаем примерно так
HTML:
Развернуть Свернуть Копировать
// Fetching HTML Elements in Variables by ID.
var x = document.getElementById("form_sample");
var createform = document.createElement('form'); // Create New Element Form
createform.setAttribute("action", ""); // Setting Action Attribute on Form
createform.setAttribute("method", "post"); // Setting Method Attribute on Form
x.appendChild(createform);

var heading = document.createElement('h2'); // Heading of Form
heading.innerHTML = "Contact Form ";
createform.appendChild(heading);

var line = document.createElement('hr'); // Giving Horizontal Row After Heading
createform.appendChild(line);

var linebreak = document.createElement('br');
createform.appendChild(linebreak);

var namelabel = document.createElement('label'); // Create Label for Name Field
namelabel.innerHTML = "Your Name : "; // Set Field Labels
createform.appendChild(namelabel);

var inputelement = document.createElement('input'); // Create Input Field for Name
inputelement.setAttribute("type", "text");
inputelement.setAttribute("name", "dname");
createform.appendChild(inputelement);

var linebreak = document.createElement('br');
createform.appendChild(linebreak);

var emaillabel = document.createElement('label'); // Create Label for E-mail Field
emaillabel.innerHTML = "Your Email : ";
createform.appendChild(emaillabel);

var emailelement = document.createElement('input'); // Create Input Field for E-mail
emailelement.setAttribute("type", "text");
emailelement.setAttribute("name", "demail");
createform.appendChild(emailelement);

var emailbreak = document.createElement('br');
createform.appendChild(emailbreak);

var messagelabel = document.createElement('label'); // Append Textarea
messagelabel.innerHTML = "Your Message : ";
createform.appendChild(messagelabel);

var texareaelement = document.createElement('textarea');
texareaelement.setAttribute("name", "dmessage");
createform.appendChild(texareaelement);

var messagebreak = document.createElement('br');
createform.appendChild(messagebreak);

var submitelement = document.createElement('input'); // Append Submit Button
submitelement.setAttribute("type", "submit");
submitelement.setAttribute("name", "dsubmit");
submitelement.setAttribute("value", "Submit");
createform.appendChild(submitelement);

В конце делаем сабмит.

С использованием джиквери еще проще, но там ее надо подгружать и т.д.

Взято тут https://www.formget.com/javascript-contact-form/
Какова цель этой формы и где можно найти применение?
 
Какова цель этой формы и где можно найти применение?
Это пример, как можно к любой странице добавить любую произвольную GET/POST форму, заполнить поля и сделать ей сабмит.
 
Это пример, как можно к любой странице добавить любую произвольную GET/POST форму, заполнить поля и сделать ей сабмит.
Так а цель какая? Что мне это даст особого? Я же не смогу так получить доступ к сайту с капчей, прикрутив отдельную форму и запустив её.
 
Так а цель какая? Что мне это даст особого? Я же не смогу так получить доступ к сайту с капчей, прикрутив отдельную форму и запустив её.
Вам ничего.

Тему форума прочитали?
 

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