4

did some google searching on the topic and most of the api's that existed required a dedicated server.

ill be trying this on the local machine and am using wamp, would i need to go through a type of merchant (of some type) to be able to send sms's?

and if you know of any tutorials list them.

thanks

sarmenhb
  • 335
  • 1
  • 5
  • 7
  • How many will you be sending? I've often wondered if my provider would complain if banged away continuously with an unlimited texting plan. Of course, they haven't canceled me over my daughter's texting yet, so I guess I'd be safe. – Nosredna Jun 20 '09 at 21:44
  • not that much but maybe send like 10-20 of them to see if it works, then figure out how i can use it. – sarmenhb Jun 20 '09 at 21:51
  • **update:** here's a good tutorial from our friends at nettuts: http://code.tutsplus.com/tutorials/how-to-send-text-messages-with-php--net-17693 – Connor Leech Mar 05 '14 at 11:53

5 Answers5

4

As mentioned in another answer you will need a 3rd party to send your messages through and you will also have to pay something for sending them.

I haven't tried it myself but this tutorial on Sending SMS thru HTTP seems like a nice way to go. It'll enable you to

Use PHP and the HTTP protocol to send text-messages from your website through an SMS gateway.

The tutorial makes use of the SMS API from TM4B which seems really intuitive. TM4B also offers gateway software for a dedicated machine (even though I know you try to avoid that). And as stated in the tutorial about TM4B:

  • They are the only gateway I know that have a simulation mode for tweaking your scripts.
  • They don't have any set-up fees.
  • Their prices are low.
  • They are reliable.
  • I use them.

At least that's the way I'd go to begin with. I think that's enough propaganda for tonight : ).

2

I've had good experiences with sending SMS through the gnokii library on Linux by using a Bluetooth connection to a Nokia phone (the PC was running Asterisk too).

Of course, this does mean you will need your own phone to use to send the SMS messages, and some way to connect to it. Make sure you check the supported phone list, which is mostly Nokia phones.

Mark Rushakoff
  • 249,864
  • 45
  • 407
  • 398
2

You will always need some sort of 3rd party to send through (be it your phone or some mobile server with your carrier). Since mobile services differ and someone has to pay for that SMS. (in most cases)

Ólafur Waage
  • 68,817
  • 22
  • 142
  • 198
2

This is what I'm using. I don't know if it works everywhere, but in Argentina (where I live) it works.

Basically you have to send an email to a special email address. I'm sending four mails (one per company) since, usually I don't know who's the client carrier.

function prepararMail($tel, $msg) {
    enviarMail("$tel@emocion.net.ar", '', "$msg");
    enviarMail("$tel@personal-net.com.ar", '', "$msg");
    enviarMail("$tel@sms.ctimovil.com.ar", '', "$msg");
    enviarMail("$tel@page.nextel.com", '', "$msg");
}

function EnviarMail($dest, $subject, $msg) {
    $from_name = "Your name";
    $from_email = "your email";
    $headers = sprintf ("From: %s <%s>\nSender: %s <%s>\nContent-Type: text/plain; charset=\"UTF-8\"\nContent-Transfer-Encoding: 8bit\n", $from_name, $from_email, $from_name, $from_email);

    mail($dest, $subject, $msg, $headers);
}
Jason Plank
  • 2,336
  • 5
  • 31
  • 40
The Disintegrator
  • 4,147
  • 9
  • 35
  • 43
2

Twilio offers a simple and affordable API and a PHP helper library that makes this very easy.

[Full disclosure: I work for Twilio, but was a happy customer before I started here.]

John Sheehan
  • 77,456
  • 30
  • 160
  • 194