Hello all,

I am new to php and thus far i'm love the potential this language has as I learn more about it.


I have been trying to write a script to no avail.


What I am trying to accomplish is to setup a sms site from web to mobile. I have looked at allot of other applications but I don't think that those are what i'm looking for. I believe a script would accomplish my goal.


Here's my goal, Webapge layout something like this:

Mobile number Select Provider(drop down box)

Subject (optional)

Message Delivery time (select when to send message)

Captcha (to help avoid bots/spam)


Send

Can anyone assist with this? Please speak in laymans terms as much as possible when responding. Thanks. :lol:

Hi,

Which are you having the problem with? The creation of the form and PHP code to process the form? Or the PHP for sending SMS?

Do you already have some php written that you could post?

Hello!

The php for sending sms messages is simple, but for this to work you will need support of an sms gateway or an smsC. Better get that support before sending messages, try to do a contract with a cell phone company or web2sms sender, they will give you a template of the string in which you can include cell phone number, message ,delivery time and other variables and send the message

Hope it helps,

QaiS

I'm still struggling with both the form and the php code.

I started a few times with a basic form with the following fields: subject, name, cell number & text box. Where i'm really stuck at is, in the 'cell number' text box I would like for that to go to the provider's gateway....but I don't know how to set it up so that once someone inputs the receipient cell number it goes out like this: 1234567890@provider.com etc.


Suggestions please.

Anyone??

I'm still struggling with both the form and the php code.

I started a few times with a basic form with the following fields: subject, name, cell number & text box. Where i'm really stuck at is, in the 'cell number' text box I would like for that to go to the provider's gateway....but I don't know how to set it up so that once someone inputs the receipient cell number it goes out like this: 1234567890@provider.com etc.


Suggestions please.

You'll need a good tutorial on HTML forms and PHP form processing.

You'll also need to look up string concatenation in PHP.


I assume you're trying to send TXT messages by using the Email to SMS gateways provided freely by the cell providers.
In order to do this, you'll need the email domain for each cell providers. Do you already have this list?

Once you have this list, you just display the list to the users in a <select> box.

eg:

<select name="provider">
<option value="tmobile.com">T-Mobile</option>
...
</select>

You'll also need the phone number of course.

When the form is submitted, you receive the form submission as a HTTP POST, or GET depending on the form method.

So the provider would be in:

$_POST['provider'];

for a post method.

You take the phone number and concatenate it with the provider and send it via email using the:

mail() function.

http://php.net/mail/

Hello there...

I do have the email domain for the cell providers set to go... I would prefer to not use a 'select box' though.

Yes, i'm reading and trying to understand the PHP processing and I thought I neede to use arrays, however you're mentoning string concentration now?? Hmmm..

I guess what you have is a single sms to email gateway. So all you need is to put the number and the domain for that sms gateway together?

All you need then is to concatenate the phone number provided by the user via the form, to the SMS gateway domain.

eg:

<?php

$number = $_GET['number'];

$email = $number.'@provider.com';

mail($email, ... etc... );

?>

hi
from looking at your previous conversation history
i really think you should gather a wider understanding of php to start doing what you want to do. I learnt through lynda.com but that costs now. I would recommend
http://www.w3schools.com/php/default.asp
as a guide through your learning.

Hope this helps

Hi,

I am trying to do something similar.

The difference is that I would like a registered user to click a button on the web page to have a preprogrammed text message sent via email to their cell phone.

I would need the PHP code to concatenate the users cell phone number from the database with their registered providers domain @providersdomain.com (see: http://en.wikipedia.org/wiki/List_of_carriers_providing_Email_or_Web_to_SMS), perhaps from an array of domains in the code.

I am looking for a PHP developer to work with on this, I appreciate any recommendations or referrals.

Most of gateway provider provide you PHP library to help you to that.

I have been working on some code for this, which isn't working, but isn't kicking back errors either. If anyone is still reading this post, I'd appreciate some feedback.

Here's the form:

<div id="smsbox"><p class="smsbox"><form name="smsform" method="post" action="test_sms.php"/>Enter Mobile Number<input type="text" value="mobile #" name="mobile" size="14"/>
<select name="carrier">
    <option>-Select Carrier-</option>
    <option value="@message.alltel.com">Alltel</option>
    <option value="@paging.acswireless.com">Ameritech</option>
    <option value="@txt.att.net">AT&amp;T</option>
    <option value="@sms.bellsouth.com">BellSouth</option>
    <option value="@myboostmobile.com">Boost</option>
    <option value="@mobile.celloneusa.com">CellularOne</option>
    <option value="@sms.edgewireless.com">Edge</option>
    <option value="@mobile.mycingular.com">Cingular</option>
    <option value="@mymetropcs.com">MetroPCS</option>
    <option value="@messaging.nextel.com">Nextel</option>
    <option value="@qwestmp.com">Qwest</option>
    <option value="@pcs.rogers.com">Rogers</option>
    <option value="@messaging.sprintpcs.com">Sprint</option>
    <option value="@msg.telus.com">Telus</option>
    <option value="@tmomail.net">T-Mobile</option>
    <option value="@email.uscc.net">US Cellular</option>
    <option value="@vtext.com">Verizon</option>
    <option value="@vmobl.com">Virgin</option>
</select>
<input type="submit" name="submit" value="send sms"></form></div>

And here's the respective PHP handler.

<?
$from = "my@email.com";
$to = $_POST['mobile'];
$carrier = $_POST['carrier'];
$to = $mobile.$carrier;
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

Never mind. This works like a charm. This kid is nice ;) My host was running me on an old server with outdated PHP and M$ IIS. (It was my first hosting package I ever bought back in '02 and thought M$ would be best - Linux servers are much better, IMHO.) I updated to 5.x, 7.0 IIS and it's running as desired.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.