Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMS/Text message sending via PHP

I'm interested in knowing if it would be at all feasible to be able to send text messages via PHP. The main purpose of which would be to send a single message to a group of people - 10+ - with updates regarding news and such. Preferably the solution should be free, though it is not a necessity in any way. Thanks to all in advance.

like image 952
Onion Avatar asked Sep 05 '09 14:09

Onion


3 Answers

I've done this with PHP, and it works very well. Text messages are nothing more than an email, usually with the receiver's 10 digit number @address.com. If you want to send text messages to someone with PHP, you'll need to get the proper address:

Here is a Partial List

You'll want to be careful with how long your messages get, since at about 55 characters (I believe) your message can be either split into multiple texts, or lost.

Sending texts via email is free.

like image 98
Fiarr Avatar answered Nov 08 '22 00:11

Fiarr


I'm interested in knowing if it would be at all feasible to be able to send text messages via PHP

Of course, it is feasible ;-)
Everything can be done, in PHP ;-)

For more informations, you can take a look at these questions/answers, which provide some useful informations :

  • SMS from web application
  • Send SMS from PHP
  • any good php tutorial on how to send sms to phones?

There are several providers that you can use as gateway to send SMS ; still, probably not free (SMS are not free, after all, generally speaking) -- but costs are not that big...

like image 21
Pascal MARTIN Avatar answered Nov 07 '22 23:11

Pascal MARTIN


If you have your own android phone and don't want to pay for a SMS Gateway you can set up your own one.

download SMS Gateway API (Play store) which is a free app that you can use to send and receive messages using HTTP requests. here is a PHP example from their site.

$URL = "http://v2.smsgateway.me/API/Send/Single.php";

$postdata = http_build_query(
    array(
    'Username' => "[email protected]",
    'Password' => "password",
    'Number' => "+447791064782",
    'Message' => "Hello World!",
    )
);

$opts = array('http' => array('method'  => 'POST', 'header'  => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));

$context  = stream_context_create($opts);

$result = file_get_contents($URL, false, $context);
like image 1
user3144832 Avatar answered Nov 08 '22 00:11

user3144832