Skip to content

Instantly share code, notes, and snippets.

@mostafasoufi
Last active March 15, 2019 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mostafasoufi/9508413cea0900f6ca2863490666a1e8 to your computer and use it in GitHub Desktop.
Save mostafasoufi/9508413cea0900f6ca2863490666a1e8 to your computer and use it in GitHub Desktop.
Sending SMS in WordPress (Required WP-SMS plugin)
<form method="post" action="">
<label>
Destination number:
<input type="text" value="" name="number" required>
</label>
<label>
Text:
<textarea name="message" required></textarea>
</label>
<input type="submit" name="sendsms">
</form>
<?php
if( isset($_POST['sendsms'])) {
if( is_object($sms) ) {
global $sms;
$sms->to = array($_POST['number']);
$sms->msg = $_POST['message'];
$result = $sms->SendSMS();
if($result) {
echo 'SMS was sent successfully.';
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment