What, exactly, are the requirements? (And no, I think nobody will be able post "sample code" for that - there is no short piece of code that could usefully be posted in order to demonstrate how this could be implemented.)
You could also check the discussions listed below in the "Threads others viewed" section.
Joined: Mar 06, 2012
i need API for SMS and which site is providing best SMS gateway
Joined: Sep 21, 2011
So you don't want to create an SMS gateway, you want to to access from your web site? Search for "bulk sms sending" or some such term, it will find many providers. There's no standard API to access such services, but you should find all information you need on the web site of whichever provider you end up using.
subject: Need Help to Create SMS GateWay For my Website