Quantcast
Channel: Lil Josh » PHP
Viewing all articles
Browse latest Browse all 11

Texting with PHP

$
0
0

Ever needed to text someone through PHP? It’s very simple! Most cellular providers give an email address with your phone number that can be used to text that number. This is known as “email to SMS gateway”. For example if my number is (555) 555-5555 and I used AT&T then emailing 5555555555@txt.att.net would send a text to my phone. So you can probably guess how the PHP looks, but here’s an example:

<?php
    $from = "Lil Josh <info@liljosh.com>"; // sender
    $subject = "Subject appears in the text message";
    $message = "This is the contents of the text";
    
    // send text message
    mail("5555555555@vtext.com",$subject,$message,"From: $from\n"); // Verizon
    mail("5555555555@txt.att.net",$subject,$message,"From: $from\n"); // AT&T
    mail("5555555555@tmomail.net",$subject,$message,"From: $from\n"); // T-Mobile
    mail("5555555555@vmobl.com",$subject,$message,"From: $from\n"); // Virgin Mobile
    mail("5555555555@messaging.sprintpcs.com",$subject,$message,"From: $from\n"); // Sprint
    mail("5555555555@messaging.nextel.com",$subject,$message,"From: $from\n"); // Nextel
?>

For a more complete list of providers visit http://www.ukrainecalling.com/email-to-text.aspx


Viewing all articles
Browse latest Browse all 11

Trending Articles