You are on page 1of 4

 Home Code Editor Project New Demo New SQL Web Development 

Menu

Custom Search

250Mb
Need a Website Or Web Application Or Any Help In Code As Broadband
Per Your Budget, Contact Us: +91 9437911966 (Whatsapp)

How to integrate SMS In PHP form Now with


Smart WiFi
❮ Previous Next ❯

Here we have two files for integrate SMS in PHP form

index.php
process.php

index.php

<!DOCTYPE html>
<html>
<title>Form</title>
<body>
<form action="process.php" method="post">
Name:<input class="input" type="text"

placeholder="name" name="name"
required><br><br>
Email:<input class="input" type="email"

placeholder="email" name="email"

required><br><br>
Phone:<input class="input" type="text"

placeholder="phone" name="phone"

required><br><br>
<button type="submit" name="btn-

save">Submit</button>
</form>
</body>
</html>

process.php

<?php
//Your authentication key
$authKey = "abccccccccccfsssfresrr";

// mobiles numbers
$mobileNumber = $_POST["phone"];

//Sender ID,While using route4 sender id should be 6 ch


$senderId = "STUDEN";

//Your message to send, Add URL encoding here.


$message = urlencode("Thank u for register with us. we

//Define route
$route = "route=4";
//Prepare you post parameters
$postData = array(
'authkey' => $authKey,
'mobiles' => $mobileNumber,
'message' => $message,
'sender' => $senderId,
'route' => $route
);
//Put your sms provider api
$url="http://sms.com/api/sendhttp.php";

// init the resource


$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData
//,CURLOPT_FOLLOWLOCATION => true
));

//Ignore SSL certificate verification


curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

//get response
$output = curl_exec($ch);

//Print error if any


if(curl_errno($ch))
{

echo 'error:' . curl_error($ch);


}

curl_close($ch);

echo $output;
$url='localhost';
$username='admin';
$password='';
$conn=mysqli_connect($url,$username,$password,"sms");
if(!$conn){
die('Could not Connect My Sql:' .mysql_error());
}
if(isset($_POST['btn-save']))
{
// variables for input data

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
// sql query for inserting data into database

mysqli_query($conn,"insert into loginuser (name, email,

echo 'Thank u for your contact with us.';

}
?>

❮ Previous Next ❯

Follow Us

   

Copyright © 2019 By studentstutorial.com. All Rights Reserved.

You might also like