tags:

views:

68

answers:

4

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: http://stackoverflow.com/questions/322440/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

-- Henry

A: 

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!

JLWarlow
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
A: 

This is what i use:

if (preg_match("@(android|iphone|opera mini|blackberry)@is",$_SERVER['HTTP_USER_AGENT'])) {
    $mobile = true;
} else {
    $mobile = false;
}
Morgen32
That only tells you if the device is mobile, it doesn't tell you anything about what transmission method they used.
henry
+1  A: 

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
A: 

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