Is this even possible?

Freddyjames

Senior Member
Joined
Jul 4, 2011
Messages
843
Reaction score
1,560
I have a site that gives a "boost" to a popular online browser game. Each page I set up generates a set of time-stamped links to click which gives the "boost" to the player through facebook.

The question is - is it possible for those links to get "clicked" automatically every 8 hours?

This is the Java I use on each page that generates the links:

Code:
<script type="text/javascript">
<!--
var d = new Date()

month=(d.getUTCMonth()+1).toString();
if(month.length<2) month = "0" + month;

day=(d.getUTCDate()).toString();
if(day.length<2) day = "0" + day;

hour=(d.getUTCHours()).toString();
if(hour.length<2) hour = "0" + hour;

minute=(d.getUTCMinutes()).toString();
if(minute.length<2) minute = "0" + minute;

for (x=1 ; x<=10 ; x++)
{
    xx = x.toString();    
    if (xx.length<2) xx = "0" + xx;
    
    h= "http://xxxxxxxxxxxxxxx/xxxxxxxxxxxx/facebook.xxxxxxxxxx.php?F=xxxxxxxxxxxxxxxxx=" + d.getUTCFullYear() + "." + month + "." + day + "+" + hour + "." + minute + "." + xx + "xxxxxxxxxxxxxxxxxx";
    document.writeln("<p>"+("Link "+x).link(h)+"</p>");";
    document.writeln("<p>"+("Link "+x).link(h)+"</p>");
}
//-->
</script>

What I want to do, is have each link auto-clicked every 8 hours, or at least auto-clicked when someone goes to the page itself.

Many thanks in advance for any help or advice.
 
Last edited:
the page will only run the script when it's visited, so there's no chance you gonna be able to do it automatic with client side js.
either php to run the script or server side js
i noticed it's not a function so it must run every time you visit a page
 
if you set a timeout to rerun and let the page open and load it might work but untested just an idea.

You might need to make it on an iframe or _blank page not sure if that would work.
 
What is a "cron job" bud? I've never heard of it before.

Cron is a time-based job scheduler that is available on all *nix server, if your host have cpanel you mostly have the option on your panel.

You could also use google's scheduler API to make it call your page or w/e.
 
Doesn't look like my host has cpanel.

I do not mind if the code has to be re-written in another language - but the links must have an individual time stamp in them.

So which option is best?
 
Put the link into a batch file and run the exe server side with time release coding for automated function calls.
 
Put the link into a batch file and run the exe server side with time release coding for automated function calls.

Ok thanks bud. I am a total noob at this sort of thing however - any pointers on where I could go to learn how to do that?
 
Back
Top