PHP Cron Job on Condition?

pkjoshi

Active Member
I am using the scheduled task to send emails on birthdays:
The setting are like this:
Run:1
Unit:day
To: {member___email}
Message:Dear {member___first_name} <br>
<b>Lions Dist ---</b> wishes you a very very Happy Birthday.
condition:
Code:
$a =(date('d-m',strtotime($row->member___birth_date_raw))==date('d-m'));
return $a;

This I think is working Ok on the limited testing I have done.

Now I want to send the SMS using the Schedule PHP plugin.
Code is like this:
Code:
$request = "";
$param[ 'mobileno' ] = "91"."{member___mobile}";
$param[ 'message' ]  = "Dear  {members___name},
Lions -- wishes you a very very Happy Birthday";
$param[ 'username' ]      = "username";
$param[ 'password' ]    = "password";
$param[ 'sendername' ]          = "sendername";
foreach ( $param as $key => $val ) {    $request .= $key . "=" . urlencode( $val );
$request .= "&";}$request = substr( $request, 0, strlen( $request ) - 1 );
$url = "http://example-sms.com/TransSMS/SMSAPI.jsp?" .
$request;$ch = curl_init( $url );curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec( $ch );
curl_close( $ch );

Now what I want is that the SMS should be sent only to members who's birthday is today. In the email plugin I was able to select the To field and fill up the condition field.
Since I don't have PHP coding knowledge, I need little help how I can modify my above code so that the SMS are sent to the member who's birthday is today.

Thanks in advance
 
You would use pretty much the same idea....

PHP:
$sendSMS = (date('d-m',strtotime('{member___birth_date_raw'})==date('d-m'));
if ($sendSMS) {
 .... do you SMS code here
}
 
Thanks So much Rob, I got the idea.
But now I am facing another problem. The placeholders are not working in the schedule PHP Plugin.
Is it something wrong with my setup? I have also created a separate thread for this issue.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top