#%C message charset #%i the smsc-id of the connection that received the message # received.php %p %C %i %a # 1 2 3 4 # insert to database received sms $d['body'] = trim(urldecode($argv[4])); $d['msisdn'] = $db->num_format(urldecode($argv[1])); $smsc = urldecode($argv[3]); $d['smsc'] = $smsc == 'auto' ? false : $smsc; $d['charset'] = urldecode($argv[2]); //$d['created_at']= "NOW()"; $num = $d['msisdn']; if ($num == "7210") { exit; } else { $db->save_messages($d); $data = $db->get_member($d['msisdn']); //echo $d['message']; # pattern to check for possible command case insensitive $pattern = '/^(.+?),(.*)/i'; if (preg_match($pattern, $d['body'], $m)) { $command = $db->get_pattern($m[1]); $d['message'] = trim($m[2]); $db->log_debug($m, "pattern-> "); } else { #$db->send_sms($d['msisdn'], $db->get_tmpl('invalid'), $d['smsc']); $command = $db->get_pattern($d['body']); if ($command) { $db->log_debug($command, "pattern-> "); switch ($command) { case 'help reply':