PHP script to send and retrive sms from a website - sms-gateway

I'm not sure where to begin, but got a case I need help from others where and if possible to solve.
Thing is, got a new alarm system at home, this system uses sms function so I can send a short code to my alarm asking for status if it`s ON or OFF, or i can turn it on/off from an sms.
Since both the sms number and code is strictly personal, I would not like to tell my carpenter the codes, but in the mean while he is working at my home, I can give him a login to my site, where he can see if the alarm is turned on or even turn it on/off by him self.
I would like to build me a website, that does the same.
Got a login to my site, when logged in, i would like the website to send an sms automatically, then retrieve the answer and display it on the website.
Is this even possible ? If so, anyone can past me in the right direction here ?
Thanks in advance =)

You can send an SMS from a website. Most mobile operators will gladly offer you an apropriate API.
For instance Deutsche Telekom has an API called "Developer Garden" that allows you to send SMS via a WebService and much more.
see here for an example: www.developergarden.com
Other providers may also offer such services.

you need an sms gateway ( we use these guys : http://inteltech.com.au/, but nearly any will do )
Your easiest option is to find one where you can insert SMS'es for sending via a URL, eg in our case the URL looks like this:
http://inteltech.com.au/secure-api/send.single.php?username=[user]&key=[longcode]&method=http&senderid=[id]&sms=[phonenumber]&message=[here's the message]
it's extremely simple to use. If your site handles the login otherwise, then you can use this for the rest.
Now, how to receive SMS'es is a bit tricker :)
But this provider, for example, offers you options to;
Send the reply as an email to a nominated email address.
Send the reply as an email to the original user who sent the message.
Send the reply as an SMS to a nominated mobile number.
POST the reply to your website or application . e.g. We can call a http/https request to your script
as you can see, both the email and the POST options are providing great ways to integrate.
I'd say if you don't handle incoming email already, then stick to the POST method.
voila :)

Related

Send Whatsapp message using a link

I came across a newsletter in which they have a WhatsApp link and when i click on it i am able send predefined message to predefined number.
SEND INQUIRY VIA WHATSAPP button is linked to below for example
https://whatsapp://send?phone=XXXXXXXX&text=Hi%2C%20this%20is%20test%20message.
Can i use this link in my newsletter without any restriction as i have a database of 2000 subscribers...
or i have to use some sort of verified mechanism using API so that whatsapp is not abused.
This link seems to be vulnerable and can be used for spam or its fine to use it
your URL is basically mal-formed.
The whatsapp:// is a kind-of protocol for transmitting information, and what you can do is to add it to a webpage as a link, so the visitor, upon clicking on that link from their phone, can access directly to Whatsapp.
Remember the oldie-goldie mailto:// which allow visitors to directly open the mail client they have on their computer, and pre-fill some email fields? This is the same.
Here is a really simple code-pen showing how can this be achieved.
Be sure to visit the codepen from your mobile:
https://codepen.io/diereysaa/pen/QWbjXGW
Replying to your specific question, there's no limitation on the use of this, since the executor will be each one of your subscribers, not your webserver. The only limitation will be your own phone, because if all of those 2,000 subscribers reply using the whatsapp link... you'll get 2,000 messages :D

Send email to pushbullet?

The website "PushBullet.com" is webwashed(filtered) by our proxy, at work.
But I really need to send some notifications to my devices.
Is there a way to send them thru the good old email protocol ?
So there is no officially supported feature for this, but you can sort of fake it using the existing email-to-push feature.
Send a push to an email address that is not a pushbullet account, such as yourgmailaccount+randomstring#gmail.com. It will have a from address of someotherrandomstring#pushbulletuseremail.com.
You can then send emails to that address, and they should show up in your pushes list.
Proposed method with random strings in email address doesn't work.
This method works. Not an email, just pure notification as required.
The library developer suggests also command line notification send. Simple and handy.
I was looking to do something similar so I could get pushbullet notifications from cron jobs, and came across this:
https://github.com/side2k/email2pb
I haven't gotten a chance to try it yet but I think this will do what you're wanting. Just tested it, and it works really well if you're able to run a postfix server.
I use Zapier for this (you can do it with a free account).
Set up a Zap to search for new mail under a label (I use "pushbullet-notify"), and send any message there to Pushbullet.
Then in Gmail just create filters for any mails you want PB notifications on, applying the same label.
The notification may be delayed up to 15 minutes from the time the email is received and labeled (free accounts check every 15 minutes).

Twilio How to collect incoming SMS messages using .net efficiently

I created an application in VB.net that ties into a scheduling software. It keeps our employees up to date by sending them SMS updates. Employees can reply back to us. Sending messages works great. The application uses the Rest API to connect to Twilio. I can also get a list of incoming messages but I can't seem to get it in a way that works well for me.
Currently my application checks if there are new messages every 5 minutes. The application gets the messages list (with filter DateSent>=today) and then loops through the messages and copies the new ones into our scheduling database.
Is it possible to do a more efficient data pull for new SMS messages using VB.net only? Can I include a time filter in addition to current filter DateSent>=today to limit the result set? Any suggestions? (I don't do web coding unfortunately) Thanks.
Twilio evangelist here.
The best way to do this is just to use Twilios web hook to let Twilio proactively tell you each time its received a message. Whats a web hook you ask? Great question.
A webhook is simply an HTTP request that Twilio will make as soon as it received an inbound SMS messages to your Twilio phone number. You normally tell Twilio to make this HTTP request to a URL that you've created and published to a public website, which you can set up easily by using something like ASP.NET. In this scenario you can think of Twilio like a web browser that is making a request to a web application that you have created.
You can tell Twilio what URL it should request by opening the Numbers tab in your Twilio dashboard, and then locating and clicking the phone number you want to configure:
Now you set the URL you want Twilio to request in the Message Request URL field and click Save:
Now when Twilio requests this URL its going to pass a bunch of parameters with its request that you can use in your application logic. You can also do things like return TwiML back to Twilio in response to its HTTP request that tell it to do things like send an SMS right back to the person who just sent one to you.
If you're looking for a bit more of a step by step, the Quickstarts on our website are pretty easy to follow and will walk you through both sending an receiving text messages. The samples are in C# but are pretty straight forward so converting to VB.NET should be easy.
Hope that helps.
I am doing something similar with VB.Net and Twilio. My solution was to put up an Azure web site and an Azure SQL Database (the two can talk to each other). I set up my Twlio to call an .ashx asp.net web page on my Azure web site. Inside of that web page I have code that reads the incoming text message and saves it to my Azure SQL Database.
Works great, but my problem is the Azure database is in "the cloud" and my app\database that sends the original SMS is on mylocal network. Not sure how to cross that divide... (I should add that my local app can read the Azure SQL database, but seems ugly to have to call out to the Azure to get data. Would have preferred to have just saved it in my local db to begin with.)
Probably not a very helpful post, but maybe give you some architectural ideas. If you want to see my .ashx page just let me know.

Sending an Email Behind the Scenes

I am currently trying to figure out how to send an email behind the scenes. Basically, I don't want an MFMailComposeViewController popping up making me press the send button. All the fields are pre-populated so there is no need to type anything out. Is this possible? Will I have to use another framework?
Thanks
You'll have to use your own mail server (or ask the user for credentials for their own, which you probably don't want to do). The iOS SDK intentionally doesn't allow you to send an email on behalf of the user with no user interface; making the user press "Send" is the whole idea so that they are never surprised.
Apps that push email out automatically either do so from their own servers, or integrate with a server framework like Mailgun, or Parse, or etc, that offer this feature.
I've done that in one of my apps using Mailgun, which is a hosted email web service.

SMS authentication for a website

I'm looking to implement an SMS authentication for one of my projects, basically before a user is able to register an account with us, we would like to authenticate the user by sending sms containing a code to his mobile phone, and get him to put in the code in our form before he can proceed.
I've been looking around and found onVerify to be a pretty good way to go
http://www.onverify.com/
But I'd like to know if there're any other alternatives similar to onVerify as it is a bit expensive, so if I could go with cheaper one, that'd be great.
Thanks!
You can do this easily enough if you have access to an SMS provider.
Typically you send an SMS to the user by making an HTTP request, containing the verification code. You'd store this code, and the recipient number, in some persistent database, against which you can compare when they fill in the details on the form.
You don't mention which geographic regions you expect your users to be in, which can be important given the variable delivery quality in some markets.
Have a look at the HTTP API for BulkSMS, message pricing and coverage.
Note that you can register in various regions, if you, for example, want to price in USD.
Disclosure: I work at BulkSMS