Skip to content

Instantly share code, notes, and snippets.

@mostafasoufi mostafasoufi/functions.php
Last active Mar 15, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.