Submit form without having loaded corresponding page?

J

jetmarc

Hi.

I hope that .javascript is the correct group for this question. I
have
a device with embedded webserver. Its page offers to reset the
device,
with the following javascript function:

function Restart()
{
if (confirm("Your Web browser will lose contact with the
camera.\nAre you sure you want to restart the camera?"))
{
var form = document.WizardForm
form.do_reboot.value = "yes"
form.submit()
}
}

Now I want to execute the reset function automatically on a
timeschedule
(every 24 hours, from crontab). How do I accomplish this? I guess I
need something like the reverse of WGET - something like a WPUT or
WSUBMIT, that talks to the embedded web server and submits a form with
do_reboot = "yes". However, I have never heard of any such tool.

How can I trigger the functionality in an automated way, without
browsing
the page and clicking the button manually?

Marc
 
Z

Zac Hester

jetmarc said:
Hi.

I hope that .javascript is the correct group for this question. I
have
a device with embedded webserver. Its page offers to reset the
device,
with the following javascript function:

function Restart()
{
if (confirm("Your Web browser will lose contact with the
camera.\nAre you sure you want to restart the camera?"))
{
var form = document.WizardForm
form.do_reboot.value = "yes"
form.submit()
}
}

Now I want to execute the reset function automatically on a
timeschedule
(every 24 hours, from crontab). How do I accomplish this? I guess I
need something like the reverse of WGET - something like a WPUT or
WSUBMIT, that talks to the embedded web server and submits a form with
do_reboot = "yes". However, I have never heard of any such tool.

How can I trigger the functionality in an automated way, without
browsing
the page and clicking the button manually?

Marc


IMO, you're making things too complicated. If you have access to set cron
jobs, you don't need to go through your HTTP server to accomplish something.
If it were me, I would look at the Perl script or PHP or whatever your form
is being submitted to (with the action="" attribute), find the line that
makes the call to reset the camera (it's probably a shell command anyway)
and put it in a shell script that can be called from cron. If you really
want to have control over this, look up any man pages about the drivers or
control programs that allow you access to the device. A lot of things are
restarted via a shell script anyway:

/usr/local/etc/rc.d/somedaemon.sh restart

(Your mileage may vary.)

Let me know if you need help finding out what the server-side script is
doing (you can email me the code from the server-side script).

HTH,
Zac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top