This PHP library will allow anyone to easily send SMS messages to any US-based mobile phone number with a one line function call.
Download phpSMS.php and include it on any page you want to send SMS messages.
<?php
require_once("./phpSMS.php");
$result = sendSMS($_POST['senderEmail'], $_POST['message'], $_POST['phoneNumber'], $_POST['carrier']);
if(!empty($result->errors)){
foreach($result->errors as $error){
echo $error . "\n";
}
}else{
echo "SMS Message successfully sent\n";
}
?>
sendSMS has four parameters (all required):
- senderEmail: The email address you want the recipient to see the message coming from.
- message: The text message you want to send. (160 character limit)
- phoneNumber: The mobile phone number you want to send a SMS message to.
- carrier: The service provider for the phone number being messaged.
A live demo can be found at http://dbcoding.com/phpSMS
Devon Bernard
- If all data is entered properly, but you select the wrong service carrier:
- sendSMS() will return true
- The recipient will NOT recieve the message you attempted to send them
- Possible future plans to try and build custom Carrier Lookup so it's not required to submit a carrier for each message