You will have to subscribe to any of the SMS gateway service providers and use their API to send out SMS. Most of these providers will give you example code snippets to use their API in different languages.