Does anybody know how I would use sockets to tap into the SMS protocol for sending+receiving SMS messages. Basically, all I want to be able to do is setup a php script that will be able to act as the SMS server and send+receive the SMS's directly through the SMS network. But I don't want to send it to an sms provider as I'm trying to make my script the sms provider. Does anybody know how to do this because I don't even know how the sms protocol works.

kvprajapati commented: Good question! +14

Recommended Answers

All 14 Replies


I doubt you'll find a free SMS service. The usual approach is to find a gateway provider or broker that has the kind of service your after.

Well now that you mention gateway provider, I guess you would say that this script I'm after acts as a gateway provider and has no external dependencies. I just need to know how.

Couldn't you send emails using the wireless provider's gateway?

Well the thing is that theoretically it should be possible for php to send the SMS without any external dependencies including email and curl. I know that sockets would be involved. But the question is how to make a custum function library the sends+receives SMS's just like how the mail() function sends emails without another company involved. And I know that I should be able to do this intirerly in php as sockets is designed for this sort of stuff.

So in basic I'm looking for a php script that sends and receives SMS messages where php directly communicates with the SMS protocol (not an api) and no external server, no external companies and no email involved.

Member Avatar

I haven't heard of such a script and I was searching hard for one a couple of years ago when setting up a school contact subsite. Everything I've seen boils down to gateway providers. I'd be v.v. interested in a script. I think everybody would be. No need for a Blackberry!

I followed the wikipedia link codejoust posted and found another wikipedia link in that page SMPP Protocol which lead me to the official open source protocol for SMS. It is written in Java but I shall be the first to convert it to php. So it is totally possible to send free SMS and will republish code when finnished as the licence says I'm allowed to redistribute it as long as it has their copywrite notice. This is so exciting.

You really think cellphone companies are going to let you send free messages through their equipment. Not going to happen.

SMS providers buy a bulk of messages from those companies at a discounted rate. Then they resell them, adding some to the price so they can make some money. It won't be possible for you to do this for free.

commented: That's true. +14
Member Avatar

Hmm, from what I've read you need a licence - the networks won't give you this - just as KK says. You'll probably find that the cost per SMS will be too high to consider. You're probably better off buying a service, although that probably defeats the object of what you're trying to achieve.

If it's not free then why is there an open source script for this protocol written by the founders of SMPP? You can check their website at

The ability to use the protocol is free, the ability to use the cellphone companies towers to send your messages is not.

The ability to use the protocol is free, not the ability to use the cellphone companies towers to send your messages.

Now I get ya. Because that's why some phone companies have better mobile coverage than others. Because they only own certain towers where as I would own no towers which means I would get zero reception and that's useless. O'well, it was a nice idea while it lasted.

Please note that the free SMS gateways both seem to be in India. way2sms appends advertising onto text messages that they send. 160by2 may do the same (that's why it's free). User beware.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.