r-it Posted October 22, 2008 Share Posted October 22, 2008 hi there, i have been battling for some time with this and i have had some problems. i will first explain what i have done and then pose my question: i downloaded a csv file from this site: http://ip-to-country.webhosting.info/book/print/5 and then i battled importing it into mysql via phpmyadmin. I subsequently created a php script that read from the csv file and saved the data into a mysql table and had problems with that as well because there are about 65k records that have to be written to the database and it only allowed 5k and something before i got the error exceeded maximum execution time or something. i was then able to convert the csv into sql by going here: http://www.sqldbu.com/eng/sections/tips/mysqlimport.html and i had problems with loading this into phpmyadmin as it was a 9 meg file. i tirelessly split the file into 2 files and i was able to upload the files, albeit slow on chrome (ff3 only allows maximum 2 meg upload) and i did manage to get somewhere. this got me to think if it takes this long to create sql, i am risking having my script crash when it goes online. now to get to the question part i would like to store each ip address of a person visiting a site, and at the end of the month, i will run a cronjob which will automatically convert the ip address to its country, and then the script will add those from each country together and they will be mailed to the website owner. there are scripts and applications for such a thing but this one has more custom functionality and hence i chose to start it from scratch. what i would like to know is where can i find a place where i could send an ip address and it would return the country name, i need something like a web service, but a permanent one, but i just do not know how to go about doing this, something like this if feasible: $handle = fopen("http://url.com/".$ip, 'r'); echo fgets($handle, 4096); fclose($handle); or does someone have a better option Link to comment https://forums.phpfreaks.com/topic/129560-track-ip-address-and-create-reports/ Share on other sites More sharing options...
trq Posted October 22, 2008 Share Posted October 22, 2008 Take a look at the geoip extension. Link to comment https://forums.phpfreaks.com/topic/129560-track-ip-address-and-create-reports/#findComment-671681 Share on other sites More sharing options...
r-it Posted October 22, 2008 Author Share Posted October 22, 2008 thanks a lot thorpe for this, but would you say in your experience, that using the csv file and having to update it every month is better than using the api? Link to comment https://forums.phpfreaks.com/topic/129560-track-ip-address-and-create-reports/#findComment-671714 Share on other sites More sharing options...
trq Posted October 22, 2008 Share Posted October 22, 2008 To be honest, Ive never had the need to use any implimentation. Link to comment https://forums.phpfreaks.com/topic/129560-track-ip-address-and-create-reports/#findComment-671778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.