yii - setup Cronjob to call php framework's method in cpanel -


hi guys have written code call mailing functionality, run on particular time. using yii framework , want call somemethod of somecontroller. have written wget http://example.com/mycontroller/mymethod in command field,its running sending mail first email of database after throws error of 404 not found

connecting example.com|50.22.11.25|:80... connected. http request sent, awaiting response... 404 not found 2015-08-25 01:15:08 error 404: not found.

please me write correct syntax of cronjob command

editted here code trying run via cronjob

`

<?php     class sendmailcontroller extends controller     {         public function actionsendmailusingcronjob()         {             $response = array();             $countmail = 0;             $mail_template = yii::app()->db->createcommand()             ->select('*')             ->from('mail_mailing_template')             ->where('status=:status', array(':status'=>'not_sent'))             ->queryall();             foreach ($mail_template $single){                 $html = $single['template'];                 $subject = $single['subject'];                 if($single['send_to'] == 'student'){                     $response['tbl_used'] = 'students';                     $mailinglist =yii::app()->db->createcommand()                                 ->select('*')                                 ->from('mail_students')                                 ->queryall();                 }                 elseif($single['send_to'] == 'owtrainer'){                     $response['tbl_used'] = 'gym_owner';                     $mailinglist =yii::app()->db->createcommand()                     ->select('*')                     ->from('mail_gym_owners')                     ->queryall();                 }                 elseif($single['send_to'] == 'all'){                     $response['tbl_used'] = 'all';                     $student_list =yii::app()->db->createcommand()                     ->select('*')                     ->from('mail_students')                     ->queryall();                     $ownertrainer_list =yii::app()->db->createcommand()                     ->select('*')                     ->from('mail_gym_owners')                     ->queryall();                      $mailinglist = array_merge($student_list,$ownertrainer_list);                  }                 foreach ($mailinglist $singlemail){                         $this->sendmailtousers($response,$singlemail,$subject,$html);                 }             }         }         public function sendmailtousers($response,$user,$subject,$html){             require_once('helper/phpmailer/class.phpmailer.php');             $from_email=yii::app()->params['adminemail'];             $webname=yii::app()->name;               $mail    = new phpmailer();             $mail->subject = $subject ;               $total_count = 0;              $mail->addaddress($user['users_email']) ;              $mail->setfrom($from_email, $webname);             $mail->addreplyto($from_email,$webname);               $body = "".$html."";             $mail->msghtml($body);             try{                 $sent = $mail->send();                 if($sent) {                     if($response['tbl_used'] == 'students'){                         $model = students::model()->findbypk($user['user_id']);                     }elseif($response['tbl_used'] == 'gym_owner'){                         $model = gymtrainersowners::model()->findbypk($user['user_id']);                     }elseif($response['tbl_used'] == 'all'){                         return true;                     }                     if($model){                         $model->count_sent =$model->count_sent +1;                         $model->update();                     }                 }             }catch(exception $e){             }           }     } 

`

here cronjob command using

wget http://www.example.com/controller/method

if you're using cron call yii, best way of doing using command actually.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -