Receive sms on a website

html

#1

Hello to all,
I am working on an HTML website and trying to make an announcement section that can be updated by sending a SMS to the website. The announcement will only be about 140 characters regarding weather updates for business hours. Are there any recommendations that you would give to move forward to complete this task?
Thank you for your time!


#2

I don't think it is possible to send sms to a web page. Other way around yes, from web page to mobile devices it is possible. Maybe build a mobile app for modifying your web page content? Or just simply another web page? Why would it have to be a SMS?

Are you monitoring yourself these weather changes somewhere outdoors or does the weather data exist and update somewhere already? If the latter maybe update the changes in the data automatically to your web page from the source.


#3

Thank you for the respons TeNDoLLA! I am interested in a SMS feature because it allows for on the go updates and I always have my phone on me, unlike a FTP server/ computer. The announcement would be about the business clsoing early or special holiday hours, that is mannually typed depending on thecircumstance(holiday/weather)

Going off of an idea you mentioned, 'from another webpage'. Could I use a form hosted on the site(acess by mobile device's browser) ->PHP-> Save to txt file ->Somehow display txt file in a section of the "HomePage" on the website?


#4

There are SMS->email services, just like there are email -> SMS services. If you could find one, you could set up an email address for it, send the SMS, configure the service to forward it to your email address, then have a cron job that periodically checks that email box for incoming updates.


#5

You can certainly do that as well. That's a lot easier to set up than sending SMS messages and having to read and parse email messages (which is a nightmare) as well.


#6

I think that is the exact type of thing twilio would be used for.

https://www.twilio.com/sms

Individual providers like AT&T have their own APIs as well. I would assume that you would need to use an API that is provided by your carrier unless using s service like twilio.

https://developer.att.com/sms


#7

Twilio actually looks interesting service.


#8

Thank you to all that have offered ideas. I am currently working through a solution that takes the data in the txt file and publishes the content on the html "Home Page".
This is the php code on the 'Home Page'

<?php
echo readfile("anform.txt");
?>

An issue that I came across is that for the content to display the extension of the 'Home Page' needs to be .php versus .html
I attempted to use js code on the 'Home Page.html" , however could not make that successful.


#9

One issue you might have with that is that your text file will be on the server, so the js running in your browser won't find it. If that's not it, though, perhaps you could expand on "could not make that successful".

You could have your javascript code call a short routine running on the server to retrieve the information that you need to display, as long as your users have javascript enabled in their browsers.

Is there a reason why having the .php extension is an issue? Maybe a .htaccess rewrite rule could get around the problem if it's just that you don't want to have users type it in, but if it's the default / index / home page as configured, normally the server can be told to search for the appropriate extension.


#10

I had a little trouble getting the js to work, in part I don't have much background with it. Therefor, I could not make it successful. So, I have been working on getting the php code to work.
Here is the index.php (previously index.html) code:

<?php
	echo file_get_contents("anform.txt")
?>

This code pulls the contents of the txt file and displays it onto the index.html, which has been renamed to index.php . My initial concern of renaming my main homepage to .php was that I did not know how it would affect the menu linking back to the homepage(previously .html) when maneuvering around the website.


#11

Of course you should update possible links from index.html to index.php.


#12

Quick update the form has been working pretty well. I added some basic responsive css, so it looks better when the employee or boss is viewing the form on their smartphone. What I am working on now is just adding a few features that will make it easier to use.

How can I have the current Date(Month-Day) sent to php if a checkbox is selected?
This is what I currently have been trying in the Index page:

<form action="test.php" method="post">

<?php
$date = todate("(n/d)");
echo $date;
?>
<input type="checkbox" name="date"  value="<?php echo new_date('(n/d)'); ?>"/>

<input id="submit" type="submit" value="announcement">
</form>

Thank you for any input!


#13

You can get the current date and time with DateTime object and format it to suit your needs.

date_default_timezone_set('Europe/Helsinki'); // Use timezone that suits your case

$dt = new DateTime();
$today = $dt->format('m-d');
var_dump($today); // 05-31

http://php.net/manual/en/timezones.php


#14

I appreacte you helping with the date in php. Is there a way to 'call' on a funtion (the date) of php to be output from a HTML form when a checkbox is clicked?


#15

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.