Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- _____ __ __ _____ _____ _
- / ____| \/ |/ ____|/ ____| |
- | (___ | \ / | (___ | | | | __ _ ___ ___
- \___ \| |\/| |\___ \| | | |/ _` / __/ __|
- ____) | | | |____) | |____| | (_| \__ \__ \
- |_____/|_| |_|_____/ \_____|_|\__,_|___/___/
- SMS Class created by Kevin Considine, Donated to the users of Facepunch.
- */
- /* =============- Settings -=========================================================================================================== */
- // Unix
- //ini_set("sendmail_path", "/usr/sbin/sendmail -t -i -f kevin@sillydomain.com");
- // ^ You'll have to change the path depending on your server.
- // Windows
- ini_set("sendmail_from", "kevin@sillydomain.com");
- $GLOBALS['SendFrom'] = 'kevin@sillydomain.com'; // this won't work but why the hell not.
- /* ==- I wouldn't edit below this line at all ========================================================================================= */
- class SMSMessage {
- private $_Providers = array(
- /* ======================================================================================================
- Phone provider SMS forward emails, if what you're looking for isn't here then check out the Read Me.
- ====================================================================================================== */
- "verizon" => "vtext.com", // Verizon Wireless
- "t-mobile" => "tmomail.net", // T-Mobile
- "sprint" => "sprintpaging.com", // Sprint
- "sprintpcs" => "messaging.sprintpcs.com", // Sprint PCS
- "qwest" => "qwestmp.com", // Qwest
- "nextel" => "messaging.nextel.com", // Nextel
- "metropcs" => "mymetropcs.com", // Metro PCS
- "edgewireless" => "sms.edgewireless.com", // Edge Wireless
- "cingular" => "mobile.mycingular.com", // Cingular
- "cellularone" => "mobile.celloneusa.com", // Cellular One USA
- "boost" => "myboostmobile.com", // Boost Mobile
- "bellsouth" => "bellsouth.cl", // Bell South
- "att" => "txt.att.net", // AT&T
- "ameritech" => "paging.acswireless.com", // Ameritech
- "alltel" => "message.alltel.com", // Alltel
- "virginUSA" => "vmobl.com", // Virgin Mobile USA
- "virgin" => "vxtras.com", // Virgin Mobile ( non USA )
- "tracfone" => "cingularme.com", // Tracfone
- "helio" => "myhelio.com", // Helio
- "uscellular" => "email.uscc.net" // US Cellular
- );
- private $_Message = "ns";
- private $_Provider = "ns";
- private $_Number = "ns";
- public function Message($Text) {
- if(strlen($Text) > 255) {
- /* ==================================================================================
- Message is too long! We're gonna limit it to the SMS standard of 255 characters.
- ================================================================================== */
- throw new Exception('Message is too long. (LIMIT 255 CHARS)', 1);
- } else {
- $this->_Message = $Text;
- }
- }
- public function Send($Text='') {
- if($this->_Message == "ns" && $Text=='') {
- /* ====================
- Message isn't set.
- ==================== */
- throw new Exception('Message is not set', 2);
- }
- if($Text != '') {
- if(strlen($Text) > 255) {
- /* =========================================================================================
- Message is too long! We're gonna limit it to the SMS standard of 255 characters, again.
- ========================================================================================= */
- throw new Exception('Message is too long. (LIMIT 255 CHARS)', 1);
- } else {
- $this->_Message = $Text;
- }
- }
- if($this->_Provider == "ns") {
- /* ====================
- Provider isn't set.
- ==================== */
- throw new Exception('Provider is not set', 3);
- }
- if($this->_Number == "ns") {
- /* ====================
- Provider isn't set.
- ==================== */
- throw new Exception('Number is not set', 4);
- }
- $headers = 'From: '.$GLOBALS['SendFrom']. "\r\n";
- /* =====================================================================================================
- This is where the mail() function is used, if you know what you're doing you can screw with this...
- ===================================================================================================== */
- mail($this->_Number."@".$this->_Provider, "", $this->_Message, $headers);
- }
- public function __construct($Number, $Provider, $Message=false) {
- if(array_key_exists(strtolower($Provider), $this->_Providers)) {
- if(!$Message) {
- /* ========================
- Can't send right away!
- ======================== */
- $this->_Provider = $this->Providers[$Provider];
- $this->_Number = $Number;
- } else {
- /* ==================
- Send right away!
- ================== */
- $this->_Message = $Message;
- $this->_Number = $Number;
- $this->_Provider = $this->_Providers[strtolower($Provider)];
- $this->Send();
- }
- } else {
- throw new Exception('Provider does not exist or is not supported', 5);
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment