Thursday, March 21, 2013

SMS Gateway integration in PHP

The integration SMS API / Gateway with the PHP Code is very easy to implement

Following is the description of how to send SMS to a user who has registered on our web page. First of all, we have to add an HTML Element that will accept Mobile Number of the user. This mobile number value will be posted to the next PHP Page. Here, using CURL (Client URL) Library, we can post the mobile number field value to the SMS API

<form action=submit.php method=post>
Username <input type=text name=u>
Password <input type=password name=p>
Mobile Number <input type=text name=m>
<input type=submit value="Register">

PHP Page

$ch = curl_init();


// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_HEADER, false);

// grab URL and pass it to the browser

// close cURL resource, and free up system resources
echo "Successful Register ... Confirmation sent to your Mobile Number";


No comments:

Post a Comment