Sunday, April 7, 2013
How to Send a Free SMS Using PHP
1. Select the phone number that the message will be sent to. This could be acquired from a database, file, or HTTP headers. For this example, we will assume it was sent through HTTP using the GET method.
2. Append the carrier's email domain to the end of the number. This example uses only three possible carriers.
3. Set the body of the message. Remember that most mobile carriers only allow messages of 140 characters or fewer to be sent and received via SMS.
4. Set the message's headers. You will need to set a 'From' header. You can set it to a standard email, or to the number of your mobile device (as long as you append the proper domain to the end). Any other headers are optional and may not even be read by the carrier's server.
5. Call PHP's built-in mail function to send the message. Leave the second parameter blank, since SMS messages don't have a subject field.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment