First Create a ID on http://www.smsglobal.com
Copy paste this code on Notepad and save as "index.php".
<?php
function sendSMS($content) {$ch = curl_init('http://www.smsglobal.com/http-api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
return $output;
}
if(isset($_POST) && !empty($_POST)) {
//Set variables
$user = 'username';
$password = 'password';
$to = $_POST['to'];
$from = $_POST['from'];
$message = $_POST['message'];
//Encode content and send to SMS Global
$content = 'action=sendsms'.
'&user='.rawurlencode($user).
'&password='.rawurlencode($password).
'&to='.rawurlencode($to).
'&from='.rawurlencode($from).
'&text='.rawurlencode($message);
//Send SMS through curl
$output = sendSMS($content);
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Send SMS</title>
</head>
<body>
<?php if(isset($output)) echo $output; else { ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<h1>Send SMS</h1>
<table>
<tr>
<td>Phone Numbers (Separate with comma)</td>
<td><input type="text" name="to" /></td>
</tr>
<tr>
<td>Sender ID</td>
<td><input type="text" name="from" maxlength="11" /></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="message"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form><?php } ?>
</body>
</html>
Replace your smsGlobal username and password instead of "username" and "password".
Post a Comment