Walrus
Walrus

Reputation: 20444

PHP Email to SMS texting solutions

I have been testing various solutions for triggering booking reminders via SMS from PHP scripts. The closest solution I found was the ability to email text messages to specific address based on the mobile phone provider, with a list of addresses listed here:

http://en.wikipedia.org/wiki/List_of_SMS_gateways

The point is it does not seam to work. I have sent a message to O2, Vodafone and Orange so far. O2 and orange, the message sent but was not received. Vodafone, the message was returned as a null address.

Has this ability been disbanded? What are the alternatives.

Upvotes: 1

Views: 1355

Answers (2)

rgubby
rgubby

Reputation: 1311

We currently use Clickatell to do exactly what you need. http://www.clickatell.com

Once you sign up and buy some SMS credits, something like this would work..

$postString = 'api_id=123456&user=USER&password=PASS&text=YOUR SMS MSG&to=4471234567890';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.clickatell.com/http/sendmsg');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);

Hope that helps!

Upvotes: 2

Pekka
Pekka

Reputation: 449475

Sending E-Mails is not a reliable way to deliver SMS.

Usually, the recipient has to pay a fee for messages delivered this way. This method has to be explicitly activated by the mobile phone subscriber in many countries. (It is definitely the case with most carriers in Germany at least and IIRC, in the UK as well.)

Use a proper SMS gateway that feeds your messages into the mobile network as if they came from a phone. The vast majority of these services (and probably all worthwhile ones) comes with a per-message fee. This question shows a few options.

Upvotes: 1

Related Questions