PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Sep 19, 2017 7:07 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Mon May 17, 2004 11:07 am 
Offline
Forum Newbie

Joined: Mon May 17, 2004 8:59 am
Posts: 2
phice wrote:
I've whipped up a small php file that will allow the user to send text messages of 130 chars or less, to the desired phone number, and desired service.

Source:

Syntax: [ Download ] [ Hide ]
<html>
<body>
<font style=font-family:Verdana;font-size:12px;color:000000;>
<?

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) > 130) {
   echo "Message is too long. Try keeping the message under/exactly 130 characters.<p>\n\n";
  } else {
    mail($smsto, $subject, $message, "From: The xSMS service") or die("Unable to send your message. Please try again later.");
      // Record information into MySQL Database
      $time = time();
      @mysql_connect("localhost", "user", "pass");
      @mysql_select_db("php");
      mysql_query("INSERT INTO sms_messages (`number`,`service`,`email`,`message`,`time`) VALUES ('{$_POST["number"]}','{$_POST["service"]}','$smsto','{$_POST["message"]}','$time')");
    echo "Your message has been sent.<p>\n\n";
  }
}
?>
 <form method="POST" align=center action=<? echo $PHP_SELF; ?>>
 <input type=hidden name=action value=send>
 <table border=0 cellspacing=2 cellpadding=0 style=font-family:Verdana;font-size:12px;color:000000;>
  <tr><td><b>Message:</b></td><td valign="top"><textarea name=message rows=5 cols=18 wrap=no style=font-family:Verdana;font-size:12px;color:000000;></textarea></td></tr>
  <tr><td><b>Number:</b></td><td valign="top" align=left><input type="text" name=number style=font-family:Verdana;font-size:12px;color:000000; size=19></td></tr>
  <tr><td><b>Service:</b></td><td valign="top" align=left><select name=service style=font-family:Verdana;font-size:12px;color:000000;><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 valign="top" align=left></td><td valign="top" align=left><INPUT TYPE="submit" width=84 height=15 border=0 value="Send Message" style=font-family:Verdana;font-size:12px;color:000000;></td></tr>
</table>
</form>
</font>
</body>
</html>


Edit: Updated service list


Oh, firstly, thx bech for answering me,
me now wif the PHP installed,
I follow his source code,
but still face problem:

1.Notice: Undefined index: action in c:\inetpub\wwwroot\a.php on line 6
2.Notice: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\a.php on line 54

any ideas??


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 8:14 pm 
Offline
Moderator
User avatar

Joined: Sat Apr 20, 2002 3:14 pm
Posts: 1416
Location: Dallas, TX
I've fixed the code to coinside with the structure that I program with now. Tell me if you keep getting any errors.

Syntax: [ Download ] [ Hide ]
<?php  

        echo "<html>\n";

        echo "<body>\n";

        echo "<font style="font: 12px Verdana; color: #000000;">\n";

       

        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) > 130) {

                        echo "Message is too long. Try keeping the message under/exactly 130 characters.<p>\n\n";

                }

                else

                {

                        @mail($smsto, $subject, $message)

                                or die("Unable to send your message. You might have to enable your server to send mail using mail() in your php.ini file.");

                       

                        echo "Your message has been sent.<p>\n\n";

                }

        }

       

        echo "<form method="POST" action="" . $_SERVER['PHP_SELF'] . "">\n";

        echo "<input type="hidden" name="action" value="send">\n";

        echo "<table border="0" cellspacing="2" cellpadding="0" style="font: 12px Verdana; color: #000000;">\n";

       

        echo " <tr>\n";

        echo "  <td><b>Message:</b></td>\n";

        echo "  <td valign="top"><textarea name="message" rows="5" cols="18" wrap="no" style="font: 12px Verdana; color: #000000;"></textarea></td>\n";

        echo " </tr>\n";

       

        echo " <tr>\n";

        echo "  <td><b>Number:</b></td>\n";

        echo "  <td valign="top" align="left"><input type="text" name="number" style="font: 12px Verdana; color: #000000;"></td>\n";

        echo " </tr>\n";

       

        echo " <tr>\n";

        echo "  <td><b>Service:</b></td>\n";

        echo "  <td valign="top" align="left">\n";

       

        // List out the services

        echo "  <select name="service" style="font: 12px Verdana; color: #000000;">\n";

        echo "          <option value="att">AT&T Wireless\n";

        echo "          <option value="cingular">Cingular\n";

        echo "          <option value="nextel">Nextel\n";

        echo "          <option value="qwest">Qwest Wireless\n";

        echo "          <option value="sprintpcs">Sprint PCS\n";

        echo "          <option value="t-mobile">T-Mobile\n";

        echo "          <option value="verizon">Verizon\n";

        echo "          <option value="voicestream">VoiceStream\n";

        echo "  </select>\n";



        echo "  </td>\n";

        echo " </tr>\n";

        echo " <tr>\n";

        echo "  <td valign="top" align="left">&nbsp;</td>\n";

        echo "  <td valign="top" align="left">\n";

        echo "  <INPUT TYPE="submit" width="84" height="15" border="0" value="Send Message" style="font: 12px Verdana; color: #000000;">\n";

        echo "  </td>\n";

        echo " </tr>\n";

        echo "</table>\n";

        echo "</form>\n";

        echo "</font>\n";

        echo "</body>\n";

        echo "</html>";

?>

_________________
Image Image


Top
 Profile  
 
 Post subject: :(
PostPosted: Sat Jun 19, 2004 9:33 pm 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27
that doesnt work for me

I dont receive any SMS[/google][/php_man]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 2:25 am 
Offline
PHP Evangelist
User avatar

Joined: Tue Aug 13, 2002 3:35 pm
Posts: 3547
Location: Calgary, Canada
Sure you have the right service provider address?

Sure you added your area code before your number?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 2:31 am 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27
yep and yep


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 2:35 am 
Offline
PHP Evangelist
User avatar

Joined: Tue Aug 13, 2002 3:35 pm
Posts: 3547
Location: Calgary, Canada
You're provider might require additional mail headers to be defined for spam filtration reasons.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 9:34 pm 
Offline
DevNet Resident
User avatar

Joined: Sat Jan 25, 2003 2:49 am
Posts: 1094
Some forum members might find it useful if they could get a sms message whenever they're topic was replied to. I don't have a cell so wouldn't help me, but if I had one, that would be awesome.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 12:09 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
unless you get charged per sms.. yikes :P


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 10:40 am 
Offline
DevNet Resident
User avatar

Joined: Sat Jan 25, 2003 2:49 am
Posts: 1094
Yea, in that case probably not :(


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 11, 2004 1:59 pm 
Offline
Forum Contributor

Joined: Mon Jun 21, 2004 7:05 pm
Posts: 194
Location: California
There is this one site, i came across that has phone number that shows which carrier from around the world.

THe only thing is in U.S. with the Number Portability just implemented, the site still has my number as AT&T though i switch to T-Mobile and ported my number too.

Anyway, i should be useful. I think numberplan.com is the place that sells the DB listing for all Telecom number assignment.

http://www.fonefinder.net is the site i am talking about.

I am currently wondering how to send vCard through SMS to a Cell Phone. I tried sending it as email with the vCard encoding but it just shows up as text.

Anyone know about this? Sites like http://www.vazu.com provides suck service but its USD$0.30 a contact.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 11, 2004 2:56 pm 
Offline
Moderator
User avatar

Joined: Mon Nov 03, 2003 7:13 pm
Posts: 5975
Location: Odessa, Ukraine
myleow wrote:
I am currently wondering how to send vCard through SMS to a Cell Phone. I tried sending it as email with the vCard encoding but it just shows up as text.

I doubt it can be done through email if the gate in question does not support such a functionality. It's possible to send vCard messages via gsm phone connected to the server as the modem though (check out cpan module GSM-SMS-0.162)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 8:13 pm 
Offline
Forum Contributor

Joined: Tue May 25, 2004 4:28 pm
Posts: 234
wait does this work on my PERSONAL computer for FREE if i have php installed?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 4:35 pm 
Offline
Forum Contributor

Joined: Mon Jun 21, 2004 7:05 pm
Posts: 194
Location: California
The next best thing to finding a FREE sms sending provider is to find one that is supported by advertising.

Unfortunately, the majority of Free SMS sites only send Text based SMS. I require one that allow Binary encoded SMS, so i can encode my own messages. eg. vCard, vCal, OTA settings as well as normal text messages.

Regards
Mian


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 9:17 pm 
Offline
PHP Evangelist
User avatar

Joined: Tue Aug 13, 2002 3:35 pm
Posts: 3547
Location: Calgary, Canada
feyd wrote:
unless you get charged per sms.. yikes :P


heh

Most providers offer a few thousand free incoming messages per month, and then they charge you per outgoing message ($0.10-$0.20). Well that's how it is over here in western Canada.

That's an interesting phpBB mod idea indeed. I might incorporate something similar in an OOP-based BB system I'm developing.

Right now it's in a primative stage so it hardly does anything besides BBcode, emoticons, and a moderating system. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 02, 2004 12:02 am 
Offline
Forum Contributor

Joined: Tue May 25, 2004 4:28 pm
Posts: 234
how does AOL work theres? Where it has 1 number, but u can reply to it and it still goes to the correct SN


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group