HOME       >>       Websites and Web Designing

Help Needed: Text Messaging From Your Website Is it possible? How can it be done? How much does it cost, if anything


Jonnii

Hi, Im in need of some information on adding a feature to my new website in construction. Im wondering if there is such a way to have text messages sent from your website sent to UK mobile numbers. There are a few services im wanting to implent. First of which is a way of activating an account by a code sent by text message to the users mobile currently registering.Secondly, updates sent to their mobile. Eg, like how facebook sends a message when an users account recieves an inboxed message or wall post etc etc.If there is such a service or way this can be set up, how would it be done? (or where can i find the information on how?) and if there are any costs (which i imagine there will be), how much it will be. All help is much appricated and thank you in advance!


8ennett

I implemented a similar system in to a website I made for a friend. It was an off-license website where you could sign up to receive special offers and discounts via text message and they would confirm their number by replying to a confirmation text they receive. Then when they were on the mailing list my friend simply filled out a form I built on his website and clicked either send to all or send to specific number and he could send out mass text messages.

The site was called Clickatell and they have a really simply system. Using php when a person entered their details on the sign up form first I would input all the details to the database then using php I would send a request to the clickatell server using the GET variable to input the information eg. "?username=accountname&pass=MYPASS&number=0791253447&message=To confirm signup reply YES to this message" or something similar. Then when the user replied I would configure clickatell to call one of my php pages using the GET variable again eg "receive.php?from=0791253447&message=YES" then using php I would update the database to add the user to the mailing list ONLY IF the return message says YES. Now you have to pay for each individual message you send out, I think it's about 0.01p per message or something which you pre-pay for, but you can also charge for incoming messages I think. I'm not too sure about making money from the process though because I never configured the clickatell account to do that.

So that's my experience with clickatell and they were quite efficient. You also get 10 free test messages to make sure your system is working properly before buying credit.


Jonnii

Thanks very much Bennett for your fast and informative reply. I shall sign up and take a look. I might come back and hound you a little if i get stuck Will review the service and post as soon as i have enough information.


8ennett

No problem, I still have the source code from the other site if you need it


Jonnii

Hey 8ennett, thanks again for the fast reply.If you could sent that source code that would be brill! Not in need of it stright away, so you dont need to hurry.


8ennett

Ok so here's the sample code I was telling you about. It's a simple form which submits its data to the clickatell website. Now this form POSTS instead of using GET because the GET method can only process up to 100 telephone numbers.

 

<form action="http://api.clickatell.com/http/sendmsg" method="post" name="sendsms"> <table width="600" border="0" cellspacing="5" cellpadding="5"> <tr> <td colspan="2" align="center" valign="middle"><strong>Send Text Message</strong> </td> </tr> <tr> <td width="300" align="right" valign="middle">Registered Subscribers</td> <td width="300" align="left" valign="middle"><?php $showsubs = mysql_query("SELECT mobile FROM subs WHERE mobile!='0' AND validated='Yes'"); echo number_format(mysql_num_rows($showsubs)); ?></td> </tr> <tr> <td colspan="2" align="center" valign="middle"><textarea name="text" cols="60" rows="3" id="text"></textarea></td> </tr> <tr> <td colspan="2" align="center" valign="middle"><input name="sendtext" type="submit" id="sendtext" value="Send Text" /> <input name="cancel" type="button" value="Cancel" onclick="document.location='sendtext.php'" /> <input name="user" type="hidden" value="myusername" /> <input name="password" type="hidden" value="mypassword" /> <input name="api_id" type="hidden" value="3232167" /> <input name="to" type="hidden" value="<?php $countit = mysql_num_rows($showsubs); $countitmore = 1; while($row = mysql_fetch_assoc($showsubs)){ echo '447624'.$row['mobile']; if ($countitmore != $countit){ echo ','; } $countitmore++; } ?>" /></td> </tr> </table> </form>

So you can see above the form posts several pieces of information, both in the textarea tag and in hidden inputs as well. Now you need to keep the names of these inputs the same because that's how clickatell identifies the values. So along with the textarea (use javascript to limit the max letters/numbers of the textarea to 160 as the message cannot be longer for a single message, longer will cost more) there are also the hidden inputs.

 

user : This is the username you use to login to clickatell

password : Password to login to clickatell

api_id : Clickatell provide you with this id number

to : A list of telephone numbers to send the message to, seperated by a comma only

So I have written a quick script that tells you how many subscribed users there are and also one to input those numbers in to the hidden field. The query only selects users that have validated their accounts from the database as well. When a user inputs their phone number, because it was only a local business I only required them to input the last 6 digits and I would put in the country code and area code (447624) so you can get rid of that bit if you want and have users enter their full mobile number.

 

Can't find the php file I used to process received messages strangely so sorry about that, but it's very simple to do anyway. Clickatell should have all the info you need on all this anyway.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.