FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

SMS Gateway

 


andyd34
Does anyone know of a free SMS gateway in the uk where sms messages can be sent from a form on a webpage.

Code:

<?php
//set up variables
$info = "1";
$test = "0";
$address = "www.txtlocal.com/sendsmspost.php";
$message = "Hello this is a test with an ampersand (&) and a £5 note";
$message = urlencode($message); //encode special characters (e.g. £,& etc)
$from = "Jims Autos";
$uname = "youremailaddress";
$pword = "yourpassword";
$selectednums = "447740101098";

//build url
$data = "uname=" . $uname . "&pword=" . $pword . "&message=" . $message . "&from=" . $from . "&selectednums=" . $selectednums . "&info=" . $info . "&test=" . $test;

//send messages
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$address");
//curl_setopt($ch, CURLOPT_URL,"https://$address"); //secure connection
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //use this to suppress output
$result = curl_exec ($ch); //This is the result from Txtlocal - store as required
curl_close ($ch);
?>

Ravanol
Hello,

Surely you have aleady answered your own question? The code that you include in your post is the Txtlocal.com SMS gateway - documented at http://www.txtlocal.co.uk/sms-api.php. The API is free, you simply purchase SMS credit bundles at low rates.

I use this gateway in all my applications and websites and have not had any problems at all. You also get delivery reports, and can receive messages from mobile handsets back into your code too.

Al.
andyd34
Have you seen the prices though, 8p per txt. Is there a way that a php script can communicate with a mobile through a USB port because it would be much cheaper to get an o2 top up card with 2000 free txts a month and do it that way
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Websites

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.