Hi Techs, Any free method to track country of visitor by IP? I want to store visitor country with IP in database? I know there are paid/free services who offer large IP databases but I am not interested in loading huge databases into my database. I want to track visitor country online and store into database. GlobalCashSite
IP to country translation is not a simple programming task. It requires a database. You can try this code http://code.google.com/p/php-ip-2-country/ Little John Webmaster discussions on PHP/Javascript/Perl HTML/DHTML/CSS Group Discussions
Ok, I have another idea. What about saving these sites in a variable like you told me earlier and then break that variable and extract country name. This is easy and free and always accurate? http://www.tracemyip.org/tools/website-visitors-counter-traffic-tracker-statistics/ http://www.ip2location.com/free.asp Above two sites are only example, we can use any other site that has less and neat content at home page. This way we can get 99.99% accurate country of visitor free of cost. We can save country and IP in database for next time checkup. Is this possible? GCS
It's possible to use another site to get the country from but it's not a good choice for a many reasons: After a while they might ban your server's IP. If those sites go down so will yours. It'll be slow since you'll have to send the data to their server, get the results back and show it to your user.
Here is a list with country IP's updated every month: http://ip-to-country.webhosting.info/book/print/5 -clonepal
I think this should not be. Because there are thousands sites who display these kinds of widgets at their site i.e. displaying their time zone, country, browser, etc. I have seen at many sites. And if that site is getting thousands visitors daily it means that service is getting thousands IP daily and providing service without problem. I have a question if I use file_get_contents("http://www.yahoo.com"); in this case whose IP address will hit to Yahoo servers? Mine server from where command is executed or visitor's IP. This is in same contest that I mentioned above i.e. short graphical widgets showing location of visitors and sites receiving thousands visitors daily. GCS
So it means all sites using these kinds of widgets/services are hitting that service server thousands times a day and they don't get banned or face any problem and I can also do the same. The difference is I will not display widget at site instead break and get country name from it. What I have in my mind is to store IP & Country name in my local database so next time script will check that IP from database and don't hit that service server. This will reduce hits to that server. For example first day 10,000 second day 5000 third day 3000 4th day 1000 and after a week 500-1000. This will buildup my local database of IPs. Another idea would be not replying on same services i.e. for 12 hours us Service A and for other 12 hours Service B that will reduce more load on these services. The advantages of this option is 1. No need to download and uploaded huge database on monthly basis 2. No need to load huge IP list that I never needed. These databases contains IPs in millions (or at least hundred thousands that I never needed) 3. I will have only IPs that I needed. 4. Buildup local IPs database free of cost What do you think about this? GlobalCashSite
you didn't say widget you said file_get_contents(). The widgets usually work with javascript and use the visitor's IP but you'll also get some "Powered by SITE" below it! Do you have any Idea how many IPs there are?! I don't see any use in doing this unless 9K of your 10K visitors are returning visitors and not unique ones which seems highly unlikely(at least to me). Assuming you have a decent number of visitors(i.e. the 10K/day which you mentioned yourself) there isn't really any difference between using a service 24hrs and 12hrs(there's still about 5K/day)
Do you visit http://forums.digitalpoint.com forum daily? If yes does this means unlikely? No, if there is some thing on website that is daily updated and new content added on daily basis or investment status is updated then regular visitors will visit that site/forum/blog daily. This forum is visited by thousands visitors daily but only few thousands might be new visitors and rest all are returning same visitors. So no need to track returning visitor's country every time from third party service and this can be done from local database. GCS
To be honest I really don't think that 90-95% of DP visitors are returning ones. It also depends on the type of site you're running but I personally don't consider 5-10% of visitors being new ones a good rate. But you probably have the stats on this and if it is so then you have a point.
I think around 75% visitors are returning visitors at DP. There are a lot of regular buyer/sell/traders/learners/newbie/service provider who visit DP on daily basis. I will ask this question in any appropriate folder of this forum. GCS
My favourite is to use MaxMind's GeoIP system. Small in size, big in power + doesn't require a database, all information is store in an .ini file.
Here is my free method that I used to track visitor location, visit this http://www.globalcashsite.com/test3.php I will store IPs in local database and only get location by this service for new IPs. GlobalCashSite