Send reg code via SMS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Send reg code via SMS

Post by seeker2921 »

I've searched the net on how to send a text message to a cell via SMS and I found the simplewire network but I can't use there network due to the fact that I need to use each carriers network so for example the user registers on my site and enters the 10 digit cell number and then there carrier and my script sends them a temp password to prove that its there phone they are registering with.. how would I do this?
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

First off, I know that on my cell phone you can't send from provider to another provider without knowing the "e-mail" for that cell phone. I think every cell phone that receives SMS messages has an e-mail from the service provider?

So if you know the e-mail suffix for each carrier, and if you know the syntax for their e-mail addresses (xxxyyyzzzz@sms.cellprovider.com) you could set it up so it changes their cell phone number into the correct format and adds the e-mail suffix for each provider... the problem is you have to know the correct syntax and suffix for -every- provider that the user might put in :roll:

Hope this helps somewhat, perhaps another user has a brilliant idea! :wink:
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

did you look at Hotscript.com Found some SMS things there that may be useful!
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

Aww, once again I was saved by Illusionist :roll: Nice find Ill!
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

lol, i actually like you idea though. I might add something similar like that to my site, only limiting people to send messages to certain providers.
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

I did this...if you want to use it go ahead works pretty good

Code: Select all

<?php 
//Created by Mike L.
//Filename: sms.php
//can only be include and not ran on own
if(eregi("sms.php",$PHP_SELF)) exit(); 
?>
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
</script>
<? 
if ($_POST["action"] == "send") { 
// Sort through services 
switch($_POST["service"]) 
{ 
  case 'att': 
    	$service = "mobile.att.net"; 
   break; 
  case 'cingular': 
   	$service = "mycingular.com"; 
   break; 
  case 'nextel': 
    	$service = "messaging.nextel.com"; 
   break; 
  case 'qwest': 
    	$service = "qwestp.com"; 
   break; 
  case 'sprintpcs': 
    	$service = "messaging.sprintpcs.com"; 
   break; 
  case 't-mobile': 
    	$service = "tmomail.net"; 
   break; 
  case 'verizon': 
    	$service = "vtext.com"; 
   break; 
  case 'voicestream': 
    	$service = "voicestream.net"; 
   break; 
} 
      // Trim up a few variables 
      $number = str_replace("(", "", $_POST["number"]); 
      $number = str_replace(")", "", $number); 
      $number = str_replace("-", "", $number); 
      $number = str_replace(" ", "", $number); 
      $number = eregi_replace("^[a-zA-Z]$", "", $number); 
      $smsto = $number . "@" . $service; 
  if (strlen($message) == 0) 
  { 
  	echo "No Message was entered please try again.<p>\n\n"; 
  }
  else 
  { 
    	mail($smsto, $subject, $message, "From: $from") or die("Unable to send your message. Please try again later."); 
    	echo "Your message has been sent.<p>\n\n"; 
  } 
} 
?> 
	<form method="post" align="center" action="<?php echo $PHP_SELF; ?>"> 
	<input type=hidden name=action value=send> 
	<table border=0 cellspacing=2 cellpadding=0> 
 	<tr><td><b>Number:</b></td><td valign="top" align=left><input type="text" name=number  size=43></td></tr> 
 	<tr><td><b>Service:</b></td><td valign="top" align=left><select name=service ><option value="att">AT&T Wireless<option value="cingular">Cingular<option value="nextel">Nextel<option value="qwest">Qwest Wireless<option value="sprintpcs">Sprint PCS<option value="t-mobile">T-Mobile<option value="verizon">Verizon<option value="voicestream">VoiceStream</select></td></tr> 
 	<tr><td><b>From:(name@website.com)</b></td><td valign="top" align=left><input type="text" name=from  size=43></td></tr>
 	<tr><td><b>Message:</b></td><td valign="top"><textarea name=message rows=10 cols=40  onKeyDown="textCounter(this.form.message,this.form.remLen,130);" onKeyUp="textCounter(this.form.message,this.form.remLen,130);"></textarea></td></tr> 
  	<tr><td><b>Characters left:</b></td><td valign="top" align=left><input readonly type=text name=remLen size=3 maxlength=3 value="130"></td></tr>
   	<tr><td valign="top" align=left></td><td valign="top" align=left><INPUT TYPE="submit" width=84 height=15 border=0 value="Send Message" ></td></tr> 
	</table> 
</form>
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

Thanks for the code, It helped. But that code use's the mail function and I am woundering if that works with all carriers and is it possible to send ringtons and such using this?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

it doesnt work with all carriers all but cricket in the US basically its

$number @ carrierswebsiteforsms.com

ist just a small email

im 99.9% sure you cant send it using the mail function you have to use a gateway for that ...and it costs about 5cents a sms message (thats billed to you not the phone users)
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

I was planning on offering this service for free, If its going to cost me money to send them somehting for free I might want to re think my idea.. lol

I tried something just for kicks.. I have an e-mail for my fone.. xxxxxxxxxx@email.uscc.net and I tried to send a midi file using outlook to my cell phone and my phone got it no problem.. So do you think that I could just do the same with mail function?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

then yea you have to attach the file...ive never tried to send files to my cell phone so im not sure
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

It didn't work, I also can't get it to work using outlook again.. It's really starting to <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> me off..
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

yea i tried sending to my phone and it didnt work
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

It wouldn't cost you money to send to the phone, and it shouldn't cost the person money to receive messages (only to send)... that's how it is for me.
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

Yea, But does that include if you use a gateway and not a phone?
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

A gateway? As in sending e-mails that forward to the phone? (sorry, I'm not always on the smart side)

It's free for anyone to send me text messages (to my phone) via the internet :wink: http://sms.alaskadigitel.com/ and if you login to hotmail you can send them straight to my phone too 8)
Post Reply