Reputation: 83
Is there possibility to find out the operator name by phone number? Of course it's about the mobile phone numbers. Country is easy because of the prefix. But what about the operators?
Upvotes: -1
Views: 2695
Reputation: 404
if ( !function_exists( 'getOperator' ) ) {
function getOperator( $mobile = '' ) {
$prefix = substr( $mobile, 0, 3 );
$operator = '';
// Default value
switch ( $prefix ) {
case '018':
$operator = 'robi';
break;
case '017':
case '013':
$operator = 'gp';
break;
case '016':
$operator = 'airtel';
break;
case '019':
case '014':
$operator = 'bl';
break;
case '015':
$operator = 'teletalk';
break;
// Add more cases as needed for additional prefixes
default:
// Handle unknown prefixes if needed
break;
}
return $operator;
}
}
Upvotes: 0
Reputation: 144
Maybe it's probablity to read information about operator from sim card, on every sim card it's write information about country and operator: http://en.wikipedia.org/wiki/Mobile_country_code but in that case you have to have physical access to sim card. So your app maybe can find the operator of phone that it's runing on, but it's still imposible to find operator with only phone number, unless you have acces to operators databeses of course ;)
Upvotes: 0
Reputation: 34424
It won't be possible logically. Think of scenario where portability from one operator to another is viable keeping the same number
Upvotes: 0
Reputation: 6866
For android apps you can look into TelephonyManager
So you can have something like this
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE));
String carrierName = manager.getNetworkOperatorName();
Upvotes: 1
Reputation: 144
I don't how it's look like in every country, but in my country ( Poland ) it's imposible because the costumers can change the operator and keep old phone number.
Upvotes: 2