I

f you are developing eCommerce project than definitely you need to add feature send sms notification for site users. Sending message to user can also be used to send coupon code, let user know your bill or statement is ready etc. Sending SMS from php script is simple and tricky. This tutorial shows quick and easy way to send sms using php script. Hope its cool and help you in development. We will use twilio sms library to send SMS. Twilio is best library for sending or receiving call as well as message.

How do you send sms using php script -sgeek - sgeekorg

Create Twilio Account

Very first step to create twilio account. Twilio provides limited number of sms in trial account. Remember if you are using twilio trial account than you need to verity number first on twilio on which you want to receive text message. Otherwise you will not get text message.

Directory Structure

index.php
lib
-- Twilio
-- Twilio.php

index.php

Contains basic form which inputs phone number and message from user.

Code To Send Message

Include twilio library to access send sms service. Download twilio php library from here. Replace your twilio Account id, Authentication token and twilio number in below code. We have added validations for phone number and message than initialised twilio library.

Full Source Code

index.php

That’s It. We are ready to send SMS using PHP script now. Comment or email me on gopal@sgeek.org for further help in development.

  1. hi thanks for your help
    i am from peru
    i have a problem , the library TWILIO.PHP
    I do not find to download

    please could you help me

    Thank you !!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">