create a cron job php

Solutions on MaxInterview for create a cron job php by the best coders in the world

showing results for - "create a cron job php"
Josué
19 Apr 2017
1//The stackoverflow link with detailed explanation
2https://stackoverflow.com/questions/23544851/how-to-set-up-a-cron-job-programmatically
3
4// Create a cron job
5require_once 'xmlapi.php';
6
7/*
8 *  Instanciate the class, setting up username/password/IP
9 *  @ip - cPanel server IP, if this script is on the cPanel server replace $ip by $ip = getenv('REMOTE_HOST');
10 *  @account - string - your cPanel username
11 *  @pass - string - your cPanel password
12 */
13
14$ip = '127.0.0.1';
15$account = 'username';
16$pass = "password";
17$xmlapi = new xmlapi($ip, $account, $pass);
18
19/*
20 * Just to be sure that XML-API will use the correct port and protocol
21 * @set_port(port); change port to 2082 if it isn't redirected to HTTPS and/or using HTTP protocol, else.. use 2083
22 * @set_protocol(protocol); change protocol to http if your sever accept HTTP else put the protocol to https
23 * @set_output(format); change to XML if you want the result output w/ XML, JSON if you want the result output w/ JSON
24 */
25$xmlapi->set_port('2083');
26$xmlapi->set_protocol('https');
27$xmlapi->set_output("json");
28$xmlapi->set_debug(1);
29
30/*
31 *  @command string - The command, script, or program you wish for your cronjob to execute.
32 *  @day int - The day on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
33 *  @hour int - The hour at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
34 *  @minute int - The minute at which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
35 *  @month int - The month you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line are allowed here.
36 *  @weekday int - The weekday on which you would like this crontab entry to run. Wildcards and any acceptable input to a crontab time expression line is allowed here. Acceptable values range from 0 to 6, where 0 represents Sunday and 6 represents Saturday.
37 */
38
39$command = "/usr/bin/php cron.php";
40$day = "1";
41$hour = "1";
42$minute = "1";
43$month = "1";
44$weekday = "1";
45
46/*
47 * @api2_query(account, module, function, params)
48 */
49print $xmlapi->api2_query($account, "Cron", "add_line", array(
50    "command"=>$command,
51    "day"=>$day,
52    "hour"=>$hour,
53    "minute"=>$minute,
54    "month"=>$month,
55    "weekday"=>$weekday
56));
57
58//Response 
59{"cpanelresult":{"module":"Cron","event":{"result":1},"apiversion":2,"data":[{"statusmsg":"crontab installed","status":1,"linekey":"9b0c93fe238a185e4aa78752a49a0718"}],"func":"add_line"}}
60
queries leading to this page
php add crontab fileadd php cron jobphp set up a cron locallyrunning cron phpcron job php examplesphp call cron jobphp how to include in cron jobphp cronjob windowsjavascript cron job for php scripthow to use cron in phpschedule cron jobs by phphow to set cron job in phprun cron job from php scriptcron job phpexample of a php script for backup cron jobadd php job to cron tabphp cron job windowsschedule cron jobs in php php cron job codehow to hit cron job from phpset cron job with php scriptphp set cron add cronjob from phpset cron job in phpwhat the alternative to cron job in phpcreate a php script 2c which will be called from a cron jobsetup cron job phprun a php script from a cron jobphp settings for cron jobhow to programmatically set a cron job in phphow to run cron job using phpphp cronjobphp execute cron jobrun php cron jobcron job php with javascriptcretae cron job with php script on windowsset up cron using crontab in phphow to set a cron job php php cron jobcron job setting in phpcreate cronjob phpphp ini cron joblibrary to manage cron jobs task phpphp cron job with inputswhat is cron job in phpcron jobs for phpcron job class in phphow to set time using cron job in phpcron php scriptphp f cron jobphp run cronjobphp cron job frameworkcron job php script exampleset up a cron job phpcommand in cron job phpphp manually run a cron job php with crontabuse cron job in phphow to turn off cron tasks phpcreating cron job phpphp cron job scron job php windowsusing cron job phpcreate cron job that runs php scriptphp cron job file runscript cron phphow to create cron jon in phpphp create cron tutorialadd php job to cronphp append crontablinux cron job php scriptset a cron job with phpcreate cron job in phphcronjob example phpwindows cron job phphow to run php file using cron jobcron job php filerun php script from cron jobhow to stop cron jobs phpcron job php connect databasecron job run php fileset cron job using phphow to add php scripts to crontabwhat can you not do with cron jobs in phprun a cron job phpphp manage cron jobsphp command for the cron jobphp run cron jobset cron job using php codehow to run php script using cron jobphp localhost cron jobcron job examples php versioncreate cron job with php on windowshow to create cron job in php with examplecron job php linkset the value of cron job from php scripti want to add cron job run on each day in phpphp cron job scriptphp cron jobsare cron jobs just for php 3fcrontab php script examplephp setup cron joblinux create cron job to call php scriptcreate cron job in php localhostwrite cron job in phpcron job with phpcron task phpcron job in php complete tutorialwhat is a cron job phpphp start cron jobwhat is the work of cron job in phphow to make cron job for php pageimplement cron job in php to execute php scriptrun cron job in phpphp list cron jobscron job run php scriptphp script cron jobcreate cron job in ubuntu using phpdo cron in phpphp cron examplerun cron job automatically phpenable cron job in phpcron task through phpcron job tutorial phpphp cron job examplehow to use cronjob phpcron job in php edurekscron job in phpphp cron job classhow to write a cron job in windows with phphow to run cron job from command line phpcron job scedual task in phpcron job in php examplesetup cron job php scriptcron job in php query run a php script as a cron jobcreating php cron jobcron job to arun a php scripthow to implement cron job in phphow to run cron job in phphow to do cron jobs phpphp mysql scripts for cron jobsusing got to run a php cron job use php in crontabcron jobs in phpphp cron job addhow to create a cronjob in phphow to deploy cron job in phpfunction cron job in phprun a php file in cron jobcron job in php mysqlcreate a cron job phphow to call a cron job function in phphow to write cron job in phpcron job in php windowsrun php script using cron jobcron job example in phpphp create cron jobsimple php cron jobcron job with php script widowscomo hacer un cron job en phpphp without cron jobhow to set up a cron job to link to a php functioninitiate cron job phphow to make cron job in phpcreate cron in phphow to use cron job in phpcreate cron job in php exampleset cron job for php script linuxphp script to run cron jobadd crontab via phpphp program croncreate cron job phphow to run a cron job in phpcron job php examplephp run crontabrun php file in cron jobset cronjob in phpcron job php scriptphp cron job in backgroundcreate a cron job in phpphp cron scriptcron job in php sample codephp cronjcronjob phpwhat are the alternative to cron jobs in phphow to create cron job in phpcron jobs phpcreate cron job script in phpsetup cron job with phpphp cron job historyusing cron for phpcron job command phpphp command to run cron jobwindows php localhost cron jobsetup cron job from phphow to create cron job phpsimple cron job example phpphplist cron jobrun a php script cron jobadd cron job functions phpcron task in phprun a php script form a cron jobcreate cron job in phpcron job function in phpset php cron in crontabcron job in core phpcreate a cron job php