A
A
Albert Ushakov2019-10-28 13:11:56
PHP
Albert Ushakov, 2019-10-28 13:11:56

How to run form validation from the scheduler?

I made a small script (see below), when opened in the browser, everything works as it should. And if you put it on the scheduler, then no activity. Perhaps this is due to some incompatibility. Why can this be and how to fix it?
The executable PHP code fetches the page from the link, fills in the fields, and simulates clicking and submitting forms.

<?php
$url = 'https://www.example.com/bo/';
$body = 'test=start';
$c = curl_init ($url);
curl_setopt ($c, CURLOPT_POST, true);
curl_setopt ($c, CURLOPT_POSTFIELDS, $body);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec ($c);
echo $page;
echo '<script>
var input_modal = $("#phone-modal"),
  input_1 = $("#phone-buh2"),
  input_2 = $("#phone-buh1"),
  input_3 = $("#phone");
  
input_modal.val("7(777)777-77-77");
input_1.val("7(777)777-77-77");
input_2.val("7(777)777-77-77");
input_3.val("7(777)777-77-77");

setTimeout(function(){
  $(".wpcf7-submit").trigger("click");
}, 1000);
</script>';
curl_close ($c);
?>

command in scheduler
/usr/bin/wget example.com/validform.php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Ivanov, 2019-10-28
@ns174ru

use the command
/usr/bin/php -f "path to the file on the server from the root"
for example domains/qb2b.ru/validform.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question