Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Hello, Laravel? Communicating with PHP through SMS!
Jun 27, 2017 @ 11:05:29

In a previous article the SitePoint PHP blog showed you how to use Laravel, the Twilio service and some helpful packages to create an application that allowed interaction via phone calls. In this new tutorial they continue the series and update the application to allow interaction via SMS messages.

In this article, we will modify our Laravel-powered phone-capable weather forecast app so that it is accessible via SMS (text message) in addition to the voice telephone system.

They just add on the functionality rather than creating a new application for the SMS side, adding new routes, controller methods and changing up the service layer a bit. It also includes the messaging that comes back from Twilio and how the response needs to be formatted. Finally, the article shows (with screenshots included) how to configure your Twilio application to allow messaging as well as phone calls. The post ends with screenshots of the application on a mobile device sending the requests for the weather information based on the zip code provided.

tagged: tutorial laravel twilio sms weather communication series part2

Link: https://www.sitepoint.com/hello-laravel-communicating-php-sms/

SitePoint PHP Blog:
How to Secure Laravel Apps with 2FA via SMS
Mar 01, 2017 @ 11:52:23

On the SitePoint PHP blog there's a new tutorial posted by author Younes Rafie showing you how to secure your Laravel application with 2FA (two-factor authentication) via SMS messages. In this example they make use of the Twilio SMS handling to send the message to the end user's device.

While everyone is concerned about their application’s security, few take it seriously and take the plunge. The first thing you’ll notice when learning about this is that two factor authentication (2FA) is the go-to solution as a first step.

Although there have been some serious problems with using text messages as a second factor, it’s definitely safer than a plain username and password combination, given that many users tend to use popular and easy to guess passwords for critical services such as payments, chat, emails, etc. In this article, we’re going to build two factor authentication into a Laravel application using Twilio SMS as the second factor.

The tutorial then starts by explaining what the end result will look like - a basic username/password login system that will require a code (from the SMS message) to continue into the account. They walk you through the creation of a new Homestead instance and installation/configuration of the new Laravel project. It then shows the updates you'll need to make to migrations and the models to handle the storage of the SMS tokens. It also shows the Blade templates to create the code entry view and error output in case of a code validation failure.

The tutorial then integrates Twilio's PHP SDK via a provider and provides a screencast of the end result.

tagged: laravel application security sms twofactor authentication

Link: https://www.sitepoint.com/secure-laravel-apps-2fa-via-sms/

TutsPlus.com:
Building Your Startup: Preparing for Text Messaging
Jan 23, 2017 @ 09:44:52

The TutsPlus.com site has posted the latest in their (lengthy) series of tutorials showing how to use PHP to "build your startup". In this new tutorial they show how to integrate SMS functionality into the application. This is the first part covering this topic and mostly covers the setup and testing of the connection to send the necessary SMS messages.

In today's episode, I'm going to walk you through the first half of my SMS configuration for the Meeting Planner application. Basically, I'll cover choosing an SMS provider, setting up the account, building the initial application infrastructure, and trial texting.

In the next episode, I'll build specific texting scenarios into the Meeting Planner application and walk you through those decisions and the coding that followed.

He starts off talking about one of the main choices you'll have to make early on: which SMS provider you want to use to send your messages. While they list several, for the sake of the tutorial they move ahead with Twilio. He show you how to set up an account with the Twilio service and where to get the credentials to connect your application to their API. After talking a bit about things like SMS pricing and handling incoming messages he starts on the integration with Yii2 via this package. Once installed and configured he creates a simple class to send a message via Twilio and tries it out with a "First test" message.

tagged: startup build tutorial series yii2 framework twilio sms notification

Link: https://code.tutsplus.com/tutorials/building-your-startup-preparing-for-text-messaging--cms-26912

LearnComputer.com:
Sending Text Messages with PHP
Sep 25, 2012 @ 09:15:38

In this new tutorial on LearnComputer.com, they show you how to, using a simple call to PHP's mail function, you can send a text message to anyone.

Text messaging seems more convenient than making phone calls and creating your own PHP script to send these messages is a very easy thing to set up. Get on board with these other companies that have found how convenient text messages are for their customer and start integrating text messaging into your PHP applications. In this article, I will show you two ways to accomplish this and you will be surprised at how simple this is to do.

Once you've found the right email address for the provider, sending the message is pretty simple using mail. As an alternative, they recommend a service like TextMagic to send the messages. It's a bit more reliable and uses SMS instead of email to get your message out.

tagged: text message email textmagic sms tutorial

Link:

PHPMaster.com:
Implement Two-Way SMS with PHP
Jul 17, 2012 @ 08:46:22

PHPMaster.com has an interesting new article posted today showing how you can use PHP to create a two-way messaging (SMS) application that can both send and initiate actions based on message content.

SMS is used for various purposes these days. For example, major websites like Gmail and Facebook use SMS to improve their authentication process with multi-factor authentication and notifying users about the updates. These are one-way SMS applications since messages are sent only from these sites to the user. Two-way SMS applications are more complex than one-way ones. In two-way SMS apps, a user can initiate a conversation by sending messages, and then the application responds according to the user’s commands.

They base the application on the Clickatell SMS service (not free, but cheap - pay by the message too) which includes the ability to hook into your API on a specific endpoint and relay the message data. The message can either be sent via a POST or GET and can easily be interpreted in your app extracting things like a timestamp, the number it came from and, of course, the actual text of the message. There's also a section about the "User Data Header" functionality that lets you easily split up a message for recombination on the remote device. Code is included for all examples.

tagged: sms tutorial bidirectional send receive

Link:

Cats Who Code:
Sending SMS with PHP and TextMagic: An A to Z guide
Mar 27, 2012 @ 10:57:15

On the Cats Who Code site today there's a new tutorial showing how to send SMS messages from your PHP application with the help of the TextMagic service.

Over the years, Short message service (SMS) has become a very important way of communication, and many businesses are looking for easy ways to send automated text messages to their customers. In this tutorial, I'm going to show you how you can send SMS using PHP and a third party service called TextMagic. Its very easy to do!

They step you through the process - creating a TextMagic account, configuring the account with your own password and creating a simple script that includes their own API library and sends the SMS request.

tagged: sms textmagic tutorial send api

Link:

Justin Carmony's Blog:
SMS Nagios Notifications with PHP & Twilio
Jan 31, 2012 @ 12:40:46

In this latest post to his blog Justin Carmony looks at a system he created to hook his Nagios notifications into the Twilio web service and have it notify him via SMS with something was wrong.

In the past I would just use my iPhone's email-to-txt email address. However, when I received the txt message, it wasn't formated very pretty, and it would have a different "From Number." So if we had a crazy day, I would have 20-30 message threads in my iPhone all about Nagios. [...] What I like out this setup is with Twilio, I can buy a phone number for $1 a month. So all my notifications come through the same number.

He's included the PHP code he uses to send the notifications (using the Twillo library) and the Nagios commands he configured to send the notifications to that script via the command line.

tagged: sms nagios tutorial twilio notifications commandline

Link:

PHPMaster.com:
Understanding the Command Design Pattern
Jan 03, 2012 @ 08:25:29

On PHPMaster.com today there's a new article introducing you to the Command design pattern and looking to help you understand its use a bit better.

The majority of [cell phone] users have opted to receive an email, but a significant number are now opting to receive the notifications via SMS. Here’s the problem: How do you send a message via two different channels to both groups of users? The logical approach would be to split the users into 2 groups, email recipients and SMS recipients, which would involve running 2 different queries and sending the codeword to each group separately. Using the Command Pattern, which I will introduce you to in this article, you can send the message to both groups of users in a single process.

He uses the message queue he mentioned as an example - showing how you can can queue up different kinds of objects (actions) based on a common interface into the same process. He creates a "DailyAlertEmail" and "DailyAlertSMS" classes, both with a "send" method. The settings for these are then pulled from a database and the "execute" method on the "MessageQueue" class is called to loop through them, calling "send" to do that work.

tagged: command designpattern tutorial message queue sms email

Link:

Gonzalo Ayuso's Blog:
Howto Send/Read SMSs using a GSM modem, AT+ commands and PHP
Mar 22, 2011 @ 08:15:27

Gonzalo Ayuso has a new post to his blog today showing how you can send and read SMS messages with PHP through a GSM modem. The AT+ commands they use can be sent via a serial (or serial-to-usb) interface directly from your application to a local device. He includes both code and some sample AT commands to get the ball rolling.

GSM modems are similar than normal modems. They’ve got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That’s means we can send (and read) SMSs and create scripts to perform those operations. [...] The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface).

His base SMS class provides open, close and read methods that talk with the device set in a child class (in this case "/dev/ttySO"). The sendSMS method is defined to take in the number to send to and the message. The AT command examples show how to send the SMS message, read all of the messages waiting and delete an SMS from the device. You can get the full code from github.

tagged: sms read send tutorial gsm modem tty

Link:

Simon Harris' Blog:
Making Phone Calls and Sending SMS with HTML
Jun 10, 2010 @ 08:59:06

In a recent post o his blog Simon Harris talks about how you can make phone calls and send SMS messages from your PHP applications (well, sort of). He shows how to trigger phone calls and SMS on certain phones by way of an HTML page.

Okay, so you can't really make phone calls and send SMS messages using only HTML; that would be silly. However, if you are developing web sites and web applications for mobile handsets, you can take advantage of some features in XHTML Mobile Profile which make it easy for a user to call a number without typing that number in. You can also use the same mechanism to trigger - on the user's handset - an SMS or MMS dialog with the intended recipient's number and the message content prepopulated.

He includes three examples if it in action (using PHP to render the page) - creating a link to make a call from the HTML, sending an SMS if the text inside a link and doing the same with a MMS message. He uses the WURFL project to make it all work and code snippets are included.

tagged: sms mms phone wurfl tutorial

Link: