Question

I'm asking this because I've been on SO most of the day, and can’t seem to get/find an answer.

This is what I'm trying to do (without using a paid gateway):

-First of all I'm setting up a database with various info and dates.

-Using a cron I will be running a script to send out that various information (user supplied) to the user on that date via an email to SMS PHP script.

-To avoid maintaining an accurate cellular carrier list. I would like to somehow ping the number and return the carrier and the appropriate "@carrier-email-extension" to send out the message. (I don't want to ask the user during registration; to streamline registration - as not to be a PIA and get more users) - I currently have a dropdown with about 50 carriers listed (I know I may have forgotten or accidentally left out some), but I don't want to have to maintain the list. I would like to delete this part of the form. Ideally, I would like to check the number via ajax/javascript as it is entered and send the carrier info to MYSQL during submission.

-The user already agrees to get SMS messages/updates/texts from my service, so nothing malicious is going on. They will agree when setting up another message:

You will be sending a SMS message with the following information {listed information} to your mobile number, {mobile number} on {date}.

Any suggestions?

Was it helpful?

Solution

If you want to determine the actual carrier of a phone number, you should do what's called an HLR (Home Location Register) lookup. Many messaging services provide such a service and they usually have an HTTP API for that. However, it is going to cost you - there is a price per each lookup, quite small but it all adds up.

Also, if you need this for specific countries, the regulatory authority in charge of phone numbering may or may not have some kind of a database service that can be queried for numbering data. These usually have fixed costs, so you should do the math if you're doing enough lookups for that country's numbers so that it pays off.

OTHER TIPS

Its two step Process.

  1. Find the Country Code of Mobile.. You can use Google API for that... Google provides that for free ( Google: libphonenumber - Google's phone number handling library )

  2. Network Code list is available on Wikipedia... For each country you have to implement that by picking the first few digits country code. ( Google: Mobile country code - Wikipedia )

You will find the network Code List for each country you will see operator name and MC /C MNC list. When you figured out country code of a country from a mobile number, Each carier has a unique MCC MNC . Then for each country you have to program a look up table; Pick the first 3 digit of of mobile number and assign him the network code... Do this exercise for your country operators you will figure it out.

Since i implemented it for a text API that is why i can tell you this.. Its lot of hard work. Good Luck!

I had this problem also - here is a quick solution that will provide you with the cellphone's carrier for Email to SMS functionality, given only the cellular number:

<?php                               
// leave this blank - we may never implement an authentication key
$smsarc_API_key = ''; 

// enter the user's 10 digit cell phone number. 
// example format: $smsarc_to = '5556667777';
$smsarc_number = '3123094991'; 

// lookup carrier
$ch = curl_init();  curl_setopt ($ch, CURLOPT_URL, 'http://www.smsarc.com/api-carrier-lookup.php?sa_number='.$smsarc_number);   $AskApache_result = curl_exec ($ch);        $smsarc_message_status =  $AskApache_result; curl_close($ch);

// print the carrier lookup results
echo $smsarc_carrier;
?>

Developer API from their site: http://www.smsarc.com/free-php-cell-phone-carrier-lookup/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top