Home Technology Technology & Life Tips SMSDiscount Web API code

SMSDiscount Web API code

How does the SMSDiscount Web API works? If you have an SMSDiscount account (see my SMSDiscount review here), you can create your own web page that can send SMSes using your SMSDiscount account.

I’ve created a simple html file that is very useful for sending a quick SMS to your “top” contacts (basically the people whom you send SMSes the most). You just need to upload this html to a folder in your web hosting/server, and then point your browser to this file to start sending SMSes with ease.

What my script does:

  • It will display your list of contacts (you have to edit this in the file)
  • You select 1 contact and type your SMS message.
  • The script will show the number of characters (make sure your message is no more than 160 chars!)
  • Click send, and it will pop-up the status of the message you just sent.

Download the file index.html (right click -> save as) : SMSDiscount API sample code

How to use the file (IMPORTANT! PLEASE READ):

  • Open the index.html file in your text editor
  • There are lines like these on the middle of the script

input name=”to” value=”#########” checked=”checked” type=”radio”>Your Contact Name input name=”to” value=”#########” type=”radio”>Your Another Contact Name input name=”to” value=”#########” type=”radio”>More of Another Contact Name

Edit them! The value should be a contact’s full mobile number (with country codes, etc). Change “Your Contact Name” to your contact’s name. You can add these lines as many as you want – try to keep it short though :) (or remove the excess lines) The “checked” meaning that this contact will be the default selected (can only be 1 “checked” contact)

  • At the end of the script, find these lines:

 

input name=”username” value=”YOUR_SMSDISCOUNT_USERNAME” type=”hidden”> input name=”password” value=”YOUR_SMSDISCOUNT_PASSWORD” type=”hidden”> input name=”from” value=”YOUR MOBILE NUMBER” type=”hidden”>

Modify the values to match your accounts at SMSDiscount.

VERY VERY IMPORTANT: This script will display your username/password on the browser and YES, people can see them if they view the HTML source code from the browser. What you need to do, is password protect your folder!! (if you are hosting, there should be a feature to password protect a folder in the control panel)

  • So, after you modify them, upload the index.html to your web server (say at http://myownserver.com/smsdiscount/index.html)
  • Password protect the smsdiscount folder with your own so other people can’t access this script
  • Run the script on your browser by typing the URL: http://myownserver.com/smsdiscount/
  • It should prompt your with username/password (if not, meaning you haven’t successfully password protected your folder!!)

Done!

Please note that this is as simple as it can be. If you want address books, etc, then I’m afraid this is not intended for that. Use your SMSDiscount desktop application :) If you know a bit of HTML, you may want to make the page prettier, but I can’t be bothered – this is as quick as it can, even if you only have a dial-up connection :)

Also, this script doesn’t show you how many credits you have left, so make sure you check your credits yourselves (from the desktop application or from www.smsdiscount.com) Happy SMS-ing :)