执行AT命令以在php中发送短信 [英] Execute AT commands to send sms in php
本文介绍了执行AT命令以在php中发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从PHP执行AT命令.
I am trying to execute AT commands from PHP.
我尝试了exec()和shell_exec()
I tried exec() and shell_exec()
请不要建议我的客户不想使用第三方SMS网关,而不想从他自己的服务器发送SMS.
Please don't suggest third party SMS gateway my client doesn't want to disclose his private information and wants to send SMS from his own server.
我有一个GSM调制解调器连接到一个串行端口,可以通过"putty"访问该端口,如图2所示.
I have a GSM modem attach to a serial port which I can access through "putty" like in fig
我可以输入AT命令来发送SMS,如下图所示.
And I can enter AT commands to send SMS like in fig below.
我想通过PHP运行那些AT命令.
I want to run those AT commands through PHP.
推荐答案
我通过此php代码在Windows 8上使用php类发送短信.
Hi I am sending sms using php class on windows 8 by this php code.
require "php_serial.class.php";
$serial = new phpSerial;
$serial->deviceSet("COM4");
$serial->confBaudRate(115200);
// Then we need to open it
$serial->deviceOpen();
// To write into
$serial->sendMessage("AT+CMGF=1\n\r");
$serial->sendMessage("AT+cmgs=\"+92234444444\"\n\r");
$serial->sendMessage("sms text\n\r");
$serial->sendMessage(chr(26));
//wait for modem to send message
sleep(7);
$read=$serial->readPort();
$serial->deviceClose();
这篇关于执行AT命令以在php中发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文