Nicholas Skinner

Freelance website and web application developer

Archive for February, 2013

8-bit SMS PDU Encoding via PHP

Thursday, February 28th, 2013

SMS PDU Encode PHP ScreenshotFor a recent project to remotely update software on Telit GSM modems I had a need to create 8-bit PDU messages using PHP, with support for the validity (expiry/timeout) period.

After searching on Google I found several online JavaScript based tools available including those by rednaxela, twit88, kekekasvi, and a C# SMS/PDU library by Stefan Mayr (which I have used in other desktop based tools) however the PHP side of things was somewhat lacking. The only code I could easily find was some by Vincent Heet however it is not licensed for commercial use, only supports 7 bit encoding, and does not support the validity period in a “clean” way (i.e. without manually calculating it and specifying the value in hex).

I therefore spent some time looking over the available documentation, working out how to encode PDU messages, and writing my own basic PHP PDU SMS encoding class supporting 8-bit PDU and (relative type) message validity periods.

Download: PHP SMS PDU Encoder