PHP Script – Send Free SMS Php Script

Jun 14, 2012, by admin

php  scriptIn this post, what we will share with you are some of PHP script examples to send SMS.

Text messaging has become tremendously widespread throughout the world to the point where an increasing number of web applications have integrated SMS to notify users of events, etc., directly through their mobile devices.

sms-with-php-diagramExample 1

SMS messages are just sent to special email addresses, so they can be sent from server to phone with minimal effort.

The form:


The handler:


Sending a text message to a cell phone through PHP is just a matter of attaching the correct suffix to the number and using the mail() function.

Example 2

To send and receive SMS messages from a webpage you need to have scripting support enabled on your webserver. The scripting support can be PHP or ASP. The examples presented here are using PHP.

(The very first step in setting up this system, is to install “your prefer” SMS Gateway to your computer and to verify, that you can send SMS messages from the gateway manually)

Create the HTML Form for SMS sending (To get this solution working you need to save the sendsms.html file into the WWW directory of your webserver):

C:wwwsendsms.html

It should output something like this:

send form php

Example 3

This code requires phpmailer class though.

Example 4

The following example PHP script, sendsms.php, can be used to send an SMS text message via NowSMS with PHP.

The SendSMS function is the important part of the example. This is the function that needs to be included in your PHP script.