Forum Moderators: coopster
That would list all the SMS messages on the device.
However, when calling the result i cant find a way to parse through the stream until the end and then STOP. I am currently looping using fgets but once it gets to the end of the response from the module it just sits there. (i presume waiting for more data!)
$ser = fopen("/dev/ttyS0","r+");
stream_set_timeout($ser, 4);
if (!$ser){
echo "port error";
}fputs($ser,'AT+CMGL="ALL"' . "\n\r");
while (!feof($ser)) {
$buffer = fgets($ser);
echo $buffer;
}
echo "end";
Any Ideas?
Thanks,
Ben
Out of curiosity, why are you doing this in PHP? Can you use different language for this and write wrapper for it? I never did this stuff in PHP; I would usually prototype in LabView and then convert to whatever language is needed, or keep using LabView code and write wrapper around it.