Receive sms on a website

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!

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.

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?

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.

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.

2 Likes

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

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.

1 Like

Twilio actually looks interesting service.

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.

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.

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.

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

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!

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

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?

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