to use cronjobs via php-curl
first make a php-file and insert
Display All
change 'crondo' and 'croncron'
change 'yourgame.com' to the url of your game
now open cronjob.php
add this
after
now make a cronjob
in console you can use crontab -e
cron can look like this(depends on filename and php-path)
now go to styles/templates/layout-full.tpl and delete following line
finaly you can check if it is functioning by having a look into the uni1_cronjobs_log table, and see if they are used
curl can also be used as cron directly without php.
ps. make a user wich can log in the game
the script is logging in an existing account and running the cronjobs wich would be triggert by a user.
by this the crons keep configuratable in the adminmenu and there is only one cron needed to organize them all.
first make a php-file and insert
PHP Source Code
- <?php
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://yourgame.com/index.php?page=login');
- curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "username=crondo&password=croncron&uni=1");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($ch, CURLOPT_COOKIEJAR, '');
- curl_setopt($ch, CURLOPT_COOKIEFILE, '');
- $answer = curl_exec($ch);
- curl_setopt($ch, CURLOPT_URL, 'https://yourgame.com/cronjob.php?cronjobID=111');
- curl_setopt($ch, CURLOPT_POST, false);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "");
- $answer = curl_exec($ch);
change 'yourgame.com' to the url of your game
now open cronjob.php
add this
now make a cronjob
in console you can use crontab -e
cron can look like this(depends on filename and php-path)
now go to styles/templates/layout-full.tpl and delete following line
curl can also be used as cron directly without php.
ps. make a user wich can log in the game
the script is logging in an existing account and running the cronjobs wich would be triggert by a user.
by this the crons keep configuratable in the adminmenu and there is only one cron needed to organize them all.