Advertisement
janter13

cron job cpanel API2

Nov 7th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3.  
  4. require_once('xmlapi.php');
  5.  
  6. echo '<form method="post">
  7. <nobr>
  8. Menit | Jam | Hari | Bulan | Minggu
  9. </nobr><br>
  10. <nobr>
  11. <input type="text" name="menit" style="width:15%">
  12. <input type="text" name="jam" style="width:15%">
  13. <input type="text" name="hari" style="width:15%">
  14. <input type="text" name="bulan" style="width:15%">
  15. <input type="text" name="minggu" style="width:15%">
  16. </nobr><br>
  17. Command :<br>
  18. <input type="text" name="command" value="php -q '.getcwd().'/">
  19. <input type="submit" name="add" value="Add Cron Job">
  20. </form>';
  21. if(isset($_POST['add'])){
  22. $ip = '127.0.0.3';
  23. $account = 'root';
  24. $pass = 'ngeweyuknengx3';
  25.  
  26. $xmlapi = new xmlapi($ip);
  27. $xmlapi ->password_auth($account,$pass);
  28. $xmlapi ->set_port('2083');
  29. $xmlapi ->set_output("json");
  30. $xmlapi ->set_debug(1);
  31. $args = array(
  32. 'command' => $_POST['command'],
  33. 'day' => $_POST['hari'],
  34. 'hour' => $_POST['jam'],
  35. 'minute' => $_POST['menit'],
  36. 'month' => $_POST['bulan'],
  37. 'weekday' => $_POST['minggu'],
  38. );
  39. $out = json_decode($xmlapi ->api2_query($account , 'Cron' ,'add_line' , $args),true);
  40.  
  41. echo $out[cpanelresult][module].' '.$out[cpanelresult][func].'<br>
  42. Cron Job : '.$_POST['command'].'<br>
  43. Line Key : '.$out[cpanelresult][data][0][linekey].'<br>
  44. Status : '.$out[cpanelresult][data][0][statusmsg];
  45. }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement