rembi wrote:
Ok, let me approach this from a different angle...A visit a webpage
that provides a service to me--by service, I simply mean that it
performs an action that I am interested in. To receive that service,
all I have to do is click a button. The button click initiates a call
to some javascript which completes the service. What I would like to
do is programatically simulate the "click", or to say it differently,
initiate the action specified by the <a href=...or onclick(...)
tags. I've seen a perl package that comes close
(WWW::Mechanize)...but it doesn't support javascript.
Does that help?
Yes, it does. I don't think you'll have any luck adapting a
browser-based javascript application for use in a cron task, but you can
mimic the browser's HTTP output very simply from a command line script.
If you don't want to, or can't use the PHP command line interface to
send/receive HTTP, then think about Wget
(
http://www.gnu.org/software/wget/). It's primarily a download utility,
but it can send different headers, including POST (for forms), and save
any results to file. You can automate it using a standard shell script.
HTTP itself isn't very hard to understand; an Ajax tutorial might tell
you as much as you need to know. A quick way to find out what the
browser is saying to the server is to use a traffic analyser like
Wireshark (
http://www.wireshark.org/), or Firefox's 'Live HTTP Headers'
extension (
http://livehttpheaders.mozdev.org/).