I was wondering if there is some sort of Java code that can get information from a webite ONLY when it needs to.
To better explain (by using an example) let's say I have a slow webpage (minimal traffic) where a user clicks a button and Java opens my DVD drive (Cause why not :P ). The easy way would be to read a file from the website every x seconds, but I don't want that because that would drive bandwidth and all that up (in this example remember, it's a slow webpage).
I want to know if I can get Java to NOT loop through a file every so often, but still open that DVD drive when a user clicks that button.
I would prefer if the webpage side was in PHP, if that is possible.
If the above is not possible, is it possible for Java to read when a file was last updated? If so, how? (I don't want to use a looping method, but with the "last updated" info I can choose whether to read the file or not, reducing some usage)
Please and thank you :)