Friday, September 13, 2013

how to set cron job scheduler php page execute

1 step -> Go to control planel
2step ->click Cron job
3step-> create standard cron job scheduler
4step-> put you scheduler  time to execute
last step -> put application directory root path with page  your command "input box" then click  ok example below
simple create sendemail.php

PHP example: check your php version on server then get path like :<?php  echo getcwd(); ?>

Command to run for a PHP5 cron job:
/home3/youruserfoldername/public_html/sendemail.php
Command to run for a PHP4 cron job:
/home3/youruserfoldername/public_html/sendemail.php



How does i execute Cron job using browse direct URL

<php 
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://sadf/profiles/emailalert");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
$result=curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
if($result){
echo "execute by curl ok and sending mail";
}else{
echo "not execute curl funation";
}
?>

No comments:

Post a Comment