Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Get Provider From Cell Number

I want to sms race results to participants if they provide a cell phone number.  I know that the cell phone needs to be tied to a provider in order to send it a text message.  Is there a way to get the provider from the number so the athlete doesn't have to provide that?
0
Bob Schneider
Asked:
Bob Schneider
3 Solutions
 
R. Andrew KoffronCommented:
with all the number porting the last several years I'd think it'd be very tough, and maybe you could get probably "x,y,z provider" type info but even land lines can be ported with a bit of finagling
0
 
ryan80Commented:
You could reach out to Neustar to see if they would give you that info, but I doubt it. They maintain the national database with that info.

You could also use a sms of course at a cost.
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
While you can send text via an email if you know the carrier http:Q_27955479.html#a3865569, you can do a lot more by using Twillio's api http://www.twilio.com/sms

The cost is $1 per month for a phone number and $0.075 to send out an sms (100 messages would cost you 75 cents).  All you need is the number.  It will not matter what the carrier is or if they use google voice.  You can also use the number to receive info and interact with the db.

The api is easy although they don't show classic asp http://www.twilio.com/docs/api/rest/sms
php
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library
 
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC5ef8732a3c49700934481addd5ce1659"; 
$token = "{{ auth_token }}"; 
$client = new Services_Twilio($sid, $token);
 
// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$sms = $client->account->sms_messages->get("SM800f449d0399ed014aae2bcc0cc2f2ec");
echo $sms->body;

Open in new window

classic asp
<%
		thePhone=' could be hard coded, request.form("something") or a rs("something")
		theTextMessage=' could be hard coded, request.form("something") or a rs("something")
	    accountSid = "abcxyz"
		authToken = "abcxyz"

		' setup the URL
		baseUrl = "https://api.twilio.com"
		smsUrl = baseUrl & "/2010-04-01/Accounts/" & accountSid & "/SMS/Messages"

		' setup the request and authorization
		Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
		http.open "POST", smsUrl, False, accountSid, authToken
		http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

		' call parameters
		From = "+15555555555" ' Use +1 and your phone number t
		recipient = "+1"&thePhone 'the phone number to send 

		      
		body = "Hi, I am your text message"&theTextMessage

		postData = "From=" & Server.URLEncode(From)
		postData = postData & "&To=" & Server.URLEncode(recipient)
		postData = postData & "&Body=" & Server.URLEncode(body) 

		' send the POST data
		http.send postData

		' optionally write out the response if you need to check if it worked
		'Response.Write http.responseText

		' clean up
		Set http = Nothing
		
		end if

%>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now