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.
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.