id; $sms = ""; $sms .= "To: {$row->receiver}\n"; $sms .= "\n"; $sms .= $row->message; $file = "smsout_{$id}"; $tmpnam = "/tmp/$file"; file_put_contents($tmpnam, $sms); $target = "/var/spool/sms/outgoing/$file"; rename($tmpnam, $target) or die("error renaming $tmpnam $target"); $sql = "update outbox set status='TRANSMITTING', statustime=now() where id=$id"; squery($sql); } } //end function