如何查看电话号码是否每天只发送一条短信?
我使用 nowsms 网关向自己发送短信,我想要的是我的 php 编码必须设置 crontab,每分钟都会刷新我的页面,所以一旦 cronjob 运行,它会自动向我发送短信,所以每分钟我也会得到一条短信,但是我如何只向我的手机发送一次,而 cronjob 总是每分钟运行一次?
如何查看今天我的号码已经发送过一次,所以下一分钟不需要再发送一条相同的短信给我,只需等到第二天才收到另一条短信。
这是我的发送短信编码,
SendSMS("192.168.1.31", 8800, "test", "test", 60163855853, $finalresult);
function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) {
$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
echo "errno: $errno \n";
echo "errstr: $errstr\n";
return $result;
}
fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" .rawurlencode($msgText) . " HTTP/1.0\n");
if ($username != "") {
$auth = $username . ":" . $password;
$auth = base64_encode($auth);
fwrite($fp, "Authorization: Basic " . $auth . "\n");
}
fwrite($fp, "\n");
$res = "";
while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);
return $res;
}
I using nowsms gateway to send sms to myself, What I want is my php coding must set the crontab with every minute will refresh my page, so once the cronjob running, it will auto send sms to me, so every minute also I will get one sms, but how to I just send once for my phone with the cronjob always running each of the minute?
how to check today my number already send out once, so next minute no need send another same sms to me, just wait until next day only get another sms.
here is my send sms coding,
SendSMS("192.168.1.31", 8800, "test", "test", 60163855853, $finalresult);
function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) {
$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
echo "errno: $errno \n";
echo "errstr: $errstr\n";
return $result;
}
fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" .rawurlencode($msgText) . " HTTP/1.0\n");
if ($username != "") {
$auth = $username . ":" . $password;
$auth = base64_encode($auth);
fwrite($fp, "Authorization: Basic " . $auth . "\n");
}
fwrite($fp, "\n");
$res = "";
while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);
return $res;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论