Last active
March 15, 2019 20:30
-
-
Save mostafasoufi/9508413cea0900f6ca2863490666a1e8 to your computer and use it in GitHub Desktop.
Sending SMS in WordPress (Required WP-SMS plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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