13

Does anybody know of a good way (free or paid) to determine if an incoming IP is from a mobile carrier?

There was a previous question on this: API to determine cell carrier?

and the answer was "use an ISP database and match names". I guess I'm hoping that in the year and a half since this question was asked somebody came up with something cleaner?

fingers crossed

Community
  • 1
  • 1
henry
  • 1,716
  • 3
  • 15
  • 27

5 Answers5

7

I have a mobile web site and I needed to do IP geo-location. I had a look at several IP->Location databases. One of which was MaxMind. They have a free database which provides city level accuracy, but they also have a paid for database (for a pretty reasonable fee) that gives you more detail, including what mobile carrier a mobile user is coming in on.

Go to http://www.maxmind.com and put your IP into the demo entry box (its on front page), and you'll see the detail you can get. This is the API you would need from them: http://www.maxmind.com/app/isp

Like I say, I only use the city level detail database so can't vouch for the coverage of the mobile carriers. But during my initial tests, it did always seem to return good values for the UK, Ireland, and Asian mobiles I tested.

Rgds, Kevin.

Kevin
  • 11,521
  • 22
  • 81
  • 103
  • This was useful to me, since I'm trying to ban some users based on their ip address. I definitely don't want to ban a mobile ip address, because that will cause other users and guests to encounter the ban wall when the address gets reused. – Captain Hypertext Mar 12 '16 at 02:34
0

NetAcuity aka Digital Envoy has Carrier Targeting (feature 24) which is normally pay $ license, but I believe they have a 30-day trial program.

MarkHu
  • 1,694
  • 16
  • 29
0

If this is for a web site, you could examine the HTTP_USER_AGENT. Of course this can be faked.

If this is indeed for a website, please give your users the option to look at the none mobile-optimised version!

John Warlow
  • 2,922
  • 1
  • 34
  • 49
  • 2
    This will only tell the browser type (and is easily faked). It will not tell if a user is coming in over a mobile connection, or if the user is coming in over WIFI. – Kevin Jul 19 '10 at 11:32
  • @jlwarlow is not totally wrong here, the facebook app on iOS actually leaks the carrier info in its user agent. – Etienne Martin Sep 01 '17 at 17:33
0

You could use hostip. They have a constantly evolving list of IPs and where they are located.

You can get information such as physical location, country and the host name for that IP.

You could poll for data and check the host name against a list of pre defined carriers with a regular expression or something.

More info here: http://www.hostip.info/

rgubby
  • 1,251
  • 10
  • 8
  • 1
    I live in Italy, Bergamo, a city at 45 km from Milan. My ISP is Tiscali. This service reports 'Berlin' ... – Massimo Nov 13 '11 at 14:07
  • 1
    In that case, use the tool to update it (if you haven't already) . It's a community powered tool, so by adding more accurate data it'll be better for everyone – rgubby Jan 11 '12 at 21:45
-6

This is what i use:

if (preg_match("@(android|iphone|opera mini|blackberry)@is",$_SERVER['HTTP_USER_AGENT'])) {
    $mobile = true;
} else {
    $mobile = false;
}
Nico
  • 717
  • 8
  • 16
  • 5
    That only tells you if the device is mobile, it doesn't tell you anything about what transmission method they used. – henry Jul 17 '10 at 05:04