dial windows serial modem from php
Posted
by bumperbox
on Stack Overflow
See other posts from Stack Overflow
or by bumperbox
Published on 2010-04-14T01:48:58Z
Indexed on
2010/04/14
1:53 UTC
Read the original article
Hit count: 441
I am trying to dial a phone number from php (i have a client list in a database, and thought i could use it to ring them when i click on their name
here is my code, it doesn't seem to work. I can hear the phone line click, but it doesn't seem to dial. maybe i am missing some command that needs to be sent prior to atdt?
$device = "COM4";
exec("mode $device BAUD=9600 PARITY=n DATA=8 STOP=1 xon=off octs=off rts=on");
$comport = fopen($device, "r+b");
if ($comport === false) {
die ("Failed opening com port");
} else {
echo "Com Port Open";
}
stream_set_blocking($comport, 0);
$atcmd = "ATDT222222222222\r"; // dial fake number
if (fwrite($comport, $atcmd ) === false) {
die ("Failed writing to com port");
} else {
echo "Wrote $atcmd to com port";
}
fclose($comport);
© Stack Overflow or respective owner