PHP Scheduler Using cPanel

By | September 26, 2013

Hello friends making PHP scheduler is too easy if we are using cPanel. Today i am going to provide you the tutorial for making it possible and using it in your applications or projects. So lets start…  :lol:. In this example we will create an example of sending the email on daily basis at 10 AM.

1. Create Index.php (Form for registration)

We will create a form with Name and Email fields. We will save them in our database than we will send the notification on every saved mail id at our given time.

<form action="<?php $_SERVER["PHP_SELF"] ?>"  method="post">
<input type="text" id="name" name="name">
<input type="text" id="email" name="email">
<input type="submit" id="subscribe" name="subscribe">
</form>

2. Get form values

Now we will save the values in our database. I am not writing the whole code for saving the values in the database.

if(isset($_POST["submit"]))
{
$getname=$_POST["name"];
$getemail=$_POST["email"];
if($getname=="" || $getemail=="")
{
echo "Blank please enter values";
}
else
{
//save the values in the database
}
}

3. Sending Mail to email ids




After getting all the values we will start our working. Suppose we have some text to send all the email id’s. So we will just get our text and send them to all the mail id’s and we will put the unique name on every mail. You can do all the working of mail function i am going to write the steps for cPanel cron setup.

4. Getting the cron in cPanel.

click over the icon than you will get a from

In cron email just set the email id where you need the alerts.

Now we will set our form to execute the script at 10 PM daily.

Cron Scheduler Form

Now we have fill the values and set the URL. Now when the time will be 10 PM it will run the link and your script will run and send do the job what you want.

So we can schedule a task in PHP with the help of cPanel. If you have any issues than let me know i will happy to answer your queries.

~~~~ Happy Coding ~~~~

One thought on “PHP Scheduler Using cPanel

Leave a Reply

Your email address will not be published. Required fields are marked *