I figured this out the other day and thought it would be a good idea to pass on. SMS messages are just sent to special email addresses, so they can be sent from server to phone with minimal effort. Here is the form and handler, feel free to copy or modify it in any way you see fit:
Sending a text message to a cell phone through PHP is just a matter of appending the correct suffix to the number and using the mail() function. If you want to add more carriers, go here and find the carrier you are looking for. If you do not know the carrier (ie. if you want to add a "not sure" option to the pulldown menu), add @teleflip.com as the suffix. The phone numbers must be 10 digits long (XXX-XXX-XXXX).
Feel free to contact me if you are having any trouble,
The Yembo Project
I tried the email deal, first email got no response or text, second got bounced back with the message: "this does not appear to be a valid north american phone number", so I'm guessing only U.S. no.s right?
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
I don't have time to try this now, but if this works for someone let me know. If it works I might write a little Adobe Air app when I get time to text message people from my computer at work (without an IM client).
Sir, how about the opposite way. From cell to website. e.g. if the user send message, then in the website, there is a part where all the messages can be view. Any idea how to do this?
Sir, how about the opposite way. From cell to website. e.g. if the user send message, then in the website, there is a part where all the messages can be view. Any idea how to do this? i am also in search of same code can u pls tell me that it possible if yes the pls provide guid line for it .Is there any requirement of hardware or have to purchase any packages
You could always use a contact form which calls the SourceSMS API.
PHP Code:
<?php
// Data for text message. This is the text message data.
$from = "FROM"; // This is who the message appears to be from.
$to = "777000000"; //A single number or a comma-seperated list of numbers
// $message = "This is a test message from the PHP API script"; //160 chars or less
$username = "Your SourceSMS Username"; // insert your username
$pword = "Your SourceSMS API Password"; //Your developer API password
$hash = "RjK=H4kL"; //Do not change
$formCountry = "44"; //Change this to the appropiate country code (default UK)
$sourceinfo = "1"; //Display POST info
//url-*** the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
######################################################## # Login information for the SMS Gateway ########################################################
$urltouse = $ozeki_url.$url; if ($debug) { echo "Request: <br>$urltouse<br><br>"; }
//Open the URL to send the message $response = httpRequest($urltouse); if ($debug) { echo "Response: <br><pre>". str_replace(array("<",">"),array("<",">"),$response). "</pre><br>"; }
return($response); }
######################################################## # GET data from sendsms.html ########################################################
Bookmarks