There seems to be some information on sending text messages from a server to a phone, but I couldn't find much information on using a text message from a phone to execute a server script such as PHP. Is this possible to do (assuming the phone is not connected to the internet)?
You need a gateway, like Twilio for this. I'd check them out, they're easy to use and don't cost much (and no I'm not affiliated with them in anyway). You can try them out for free and their documentation is pretty good.
Disclaimer, I do developer evangelism part time at Nexmo.
Here's a few APIs you could use:
Nexmo
Twilio
Tropo
For the most part, they operate the same for your use case - when an SMS is received, they make a HTTP call to a predefined URL (the URL of your PHP script).
Since you're doing only inbound SMS, it's worth noting that Nexmo allows unlimited incoming message with a virtual numbers (the virtual number costs ~$1/month).
I believe most phone carriers allow sending email by texting. Instead of typing in the phone number you just type in an email address. I would start down that path rather than using a gateway.
Related
Hello everyone my question is very specific I'm not asking how to send sms for free, obviously it would not make sense, much less no method with gateway that many telephone companies have blocked as an anti spam method to date, but I'm asking for example through api di telegram it is possible through form php and json to send from the software a message that arrives to the recipients as if you had sent it by smartphone.
The question is: how can you send text messages with php, which connect to your tariff plan as if you were sending them by phone, thanks
Although I think your question is quite ambiguous I'd suggest 2 possible ways depending on your priority.
If your main priority is using certain tariff plan (like using cheap SMS on certain simcards etc.) - your need to connect your simcard(s) to PC/server with GSM-modem or similar hardware. Then interact with it by COM-port etc. Also you may want to ask your GSM-carrier if you can use your tariff plan (simcard account) via some API but it's extremely low chances for positive reply. The API in most cases is not related to a simcard tariff plans but it do relates to some standalone Sms service.
If you main priority is the Number which your recipients may use for replies, you can look for SMS APIs with Virtual Long Number available. Many service providers allow to send SMS via API using VLN as alphanumeric sender name. This feature enables you to collect replies.
I'm making a project in my college, and I am making a web application. This web application is in openSuse. So the OS is Linux and I'm writing the code in php.
Now I want scripts in php for including sms facility in my project. So I need full information how to go about it and what code to implement
You need to use an online SMS provider. A quick trip to google brought up this: http://www.messagemedia.co.uk/sms-gateways.html (UK only, search in your country to find one that'll work for you). Then go to their API page and they should give you a nice PHP API to use.
Two basic approaches
Use an online SMS provider, as suggested by many other comments
Use a GSM modem with software like Gammu to handle sending and receiving text messages; almost any USB GSM dongle can handle this.
If I were to do something like this, I would just use the mail() function of PHP.
In the US at least, I think all phone numbers have an email address:
19999999999#sub.carrier.com
If you can extract the carrier from the number, you could just strip all non-numeric characters from the number and use the PHP mail function to send an email to that address, which in turn is a text message. This is how I forward emails via text to my feature phone (funny, the name is misleading).
There are a number of sites that extract information from the number, but I couldn't find an explicit algorithm. Here's one (I bet you could just use file_get_contents() on that webpage to get the carrier): http://fonefinder.net/
It's not too complicated, so have fun!
Have you seen http://www.twilio.com?
It's really cheap and incredibly easy to use. Why reinvent the wheel? :)
Depends on your needs. If you need to send AND receive and be able to process the incoming messages you are going to need more than just a simple SMS provider and are going to need somebody to partition a short/long code (I'm assuming you don't want to spend 1000$/month on a Short Code) to process incoming messages and forward them to you. You can set up keywords, or regular expressions that get run on messages then forwarded to your server.
If you are just going to be using just outbound SMS (notifications, etc.) than you can use something simple like Clickatell or Twilio.
I want to create a PHP app that can send text messages ; There are different gateways for different email carriers.
Is there any library I could use that would be able to lookup or detect which gateway to use just by passing the phone number into it? This way I can take whatever email address I get out and use PHP's email functions to send a message.
There are companies that provide a lookup service, but it's generally not free (for example, we've used mBlox for this). There's no simple algorithm you can use, either, because of number porting and so on.
Zeep Mobile offers a free SMS API you can use, the catch is they tag your SMS with ads
There are a few SMS APIs out there that allow you to send without using an e-mail gateway. Twilio would be my recommendation. Using one of them you wouldn't have to even know the carrier.
As for detecting the carrier, codeka is right, there's no real way to know. Even google maps has a carrier select box.
The website http://www.freesmsgateway.info/ can provide the correct email address given a valid cellphone number (at least in the USA).
However I don't see any information about providing an API. You might, however, still be able to parse and use the results.
EDIT - I see they use an API from http://www.data24-7.com/ to power their site. Data24-7 claims to provide "real time API's".
Craigslist has a nice feature where when you respond to a poster you respond to an email such as job-fepsd-1120347193#craigslist.org. The email is then in turn directed to the real email.
I am looking for a couple pointers on how to do this with PHP.
Thanks,
Levi
This is usually done by piping an e-mail address (often, a catch-all address) to PHP. Here's a tutorial on doing it that should get you started in the right direction.
The most probable solution is by doing what they called as Email Piping.
They insert the ad with an identifier like this:
*job-fepsd-1120347193*
alongside with the real email.
Then they receive the email by piping it to a PHP script.
You can check Google for PHP and Piping where you will find good resources on the subject.
The script then searches for this Unique Identifier and associates it with a real email.
Then it forwards the email received to the real person.
There is also another possible solution (but less possible), they might be using POP3.
Then they would just make a check every X minutes on a catch-all address and then forward the message to the right person.
Elastic Email has a simple API for creating two-way anonymous email routing just like craigslist or airbnb. It uses an inbound email api to call a web-hook on your server to resolve the correct email addresses and then relays the email accordingly. It only takes a few lines of code. They have a detailed tutorial here:
https://elasticemail.com/blog/marketing_tips/how-to-build-an-anonymized-email-relaying-feature-using-elastic-email/
I want to design a website that can send and receive sms.
How should I approach the problem ?
What are the resources available ?
I know php,python what else do I need or are the better options available?
How can experiment using my pc only?[somthing like localhost]
What are some good hosting services for this? [edit this]
[Add more questions you can think of?]
You can take a look at Kannel. It's so simple to create SMS services using it. Just define a keyword, then put in the URL to which the incoming SMS request will be routed (you'll get the info such as mobile number and SMS text in query string parameters), then whatever output your web script generates (you can use any web scripting/language/platform) will be sent back to the sender.
It's simple to test. You can use your own PC and just use the fakesmsc "SMS center" and just send it HTTP requests. If you have a GSM modem you can use that too, utilising the modem's AT command set.
First thing, You need to sign up for an account (SMS gateway), most of them also give you example code how to send and receive sms using their API. Then you will wrap the the sms functionality around your sites logic.
e.g http://www.clickatell.com/developers/php.php
I've copied this from an answer I gave in relation to this question. However, in addition to the text below, take a look at Wadja's SMS Gateway deals (API link)... they appear to be a really good option at the moment, though I've not used them, personally.
Your main option for sending SMS messages is using an existing SMS provider. In my experience (which is extensive with SMS messaging web applications), you will often find that negotiating with different providers is the best way to get the best deal for your application.
Different providers often offer different services, and different features. My favourite provider, and indeed, the one that has happily negotiated with me for lower rates in the past, is TM4B (http://www.tm4b.com). These guys have excellent rates, cover a huge proportion of the globe, and have excellent customer service.
Below is some code extracted (and some parts obfuscated) from one of my live web applications, for sending a simple message via their API:
require_once("tm4b.lib.php");
$smsEngine = new tm4b();
// Prepare the array for sending
$smsRequest["username"] = "YOURUNAME";
$smsRequest["password"] = "YOURPWORD";
$smsRequest["to"] = "+441234554443";
$smsRequest["from"] = "ME!";
$smsRequest["msg"] = "Hello, test message!";
// Do the actual sending
$smsResult = $smsEngine->ClientAPI($smsRequest);
// Check the result
if( $smsResult['status'] == "ok" ) {
print "Message sent!";
} else {
print "Message not sent.";
}
Many other providers that I've used in the past, have very similar interfaces, and all are really competitive when it comes to pricing. You simply have to look around for a provider that suits your needs.
In regard to cost, you're looking at prices ranging from a few pence/cents for most Western countries (prices are a little bit higher for most third-world countries, though, so beware). Most providers you will have to pay in bulk, if you want decent rates from them, but they'll often negotiate with you for 'smaller-than-usual' batches. Most providers do offer a post-pay option, but only when you've successfully completed a few transactions with them... others offer it from the start, but the prices are extortionate.
Hope it helps!
You need a SMS server. This should get you started.
Since my company does this sometimes (text promotions etc, though our main focus is much much lower level stuff), I figured I should pitch in.
By far the simplest way is to use a service such as Clickatell, which provides a HTTP API, as well as FTP and SMPP amongst others. I don't know how Clickatell deals with receiving messages, however, as we use direct SMPP binds to our local mobile operators for this.
If you are willing to pay for it, you should be able to get an SMPP bind to your local mobile operator, but its often expensive. This would also allow you to purchase your own shortcode.
You may also want to give mBlox or Nextcell a look. A quick Google search will turn up more.
you could also buy a GSM modem, which would allow you to send and receive messages as you normally would with a phone, except through a PC. This usually means you will pay whatever you would with a phone. (In Ireland anyway)