PHP GeoLocation Help

Hi Guys, I need a little help with some PHP Code. There are several parts of my website where I want to include a particular PHP file depending on the location you access it from. For example, for the contacts information I have three different PHP files (kenya.php, nigeria.php, uk.php) I want to display specific contact information on my <div id="contacts"> depending on the location you access the website from. Any help on this? The current website is using another GeoLocation script that ade me design three different websites. Problem is, if you are accessing it from a different location, it will load the default website first then redirect you to the website for your location. Can anyone help me with this please? Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya

Off the top of my head, I can think of two un-tested theoretical solutions: If I understood you correct, you want to know which country a visitor is coming from? If yes; then 1. Examine the Accept-Language HTTP header being sent by the visitors browsers, then do a simple comparison. The limitations of this are obvious, lots of countries will send the *EN *header. 2. Use the MaxMind GeIP web service @ $20 for 200,000 requests. You may also be interested to know that there are some alternatives to MaxMind, as stated here<http://stackoverflow.com/questions/1775729/maxmind-geoip-country-city-mysql-open-source-alternative> . On Mon, Feb 6, 2012 at 10:57 AM, Allan Ouma <aouma@ymail.com> wrote:
Hi Guys,
I need a little help with some PHP Code. There are several parts of my website where I want to include a particular PHP file depending on the location you access it from. For example, for the contacts information I have three different PHP files (kenya.php, nigeria.php, uk.php) I want to display specific contact information on my <div id="contacts"> depending on the location you access the website from. Any help on this? The current website is using another GeoLocation script that ade me design three different websites. Problem is, if you are accessing it from a different location, it will load the default website first then redirect you to the website for your location.
Can anyone help me with this please?
Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------

Try this http://www.justin-cook.com/wp/2006/11/28/convert-an-ip-address-to-ip-number-... or use google's geolocation app. regards On Mon, Feb 6, 2012 at 1:53 PM, Peter Karunyu <pkarunyu@gmail.com> wrote:
Off the top of my head, I can think of two un-tested theoretical solutions:
If I understood you correct, you want to know which country a visitor is coming from?
If yes; then 1. Examine the Accept-Language HTTP header being sent by the visitors browsers, then do a simple comparison. The limitations of this are obvious, lots of countries will send the *EN *header. 2. Use the MaxMind GeIP web service @ $20 for 200,000 requests.
You may also be interested to know that there are some alternatives to MaxMind, as stated here<http://stackoverflow.com/questions/1775729/maxmind-geoip-country-city-mysql-open-source-alternative> .
On Mon, Feb 6, 2012 at 10:57 AM, Allan Ouma <aouma@ymail.com> wrote:
Hi Guys,
I need a little help with some PHP Code. There are several parts of my website where I want to include a particular PHP file depending on the location you access it from. For example, for the contacts information I have three different PHP files (kenya.php, nigeria.php, uk.php) I want to display specific contact information on my <div id="contacts"> depending on the location you access the website from. Any help on this? The current website is using another GeoLocation script that ade me design three different websites. Problem is, if you are accessing it from a different location, it will load the default website first then redirect you to the website for your location.
Can anyone help me with this please?
Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

Thanks! Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya
________________________________ From: Derrick Wesonga <wesongaderrick@gmail.com> To: Skunkworks Mailing List <skunkworks@lists.my.co.ke> Sent: Monday, February 6, 2012 4:26 PM Subject: Re: [Skunkworks] PHP GeoLocation Help
Try this http://www.justin-cook.com/wp/2006/11/28/convert-an-ip-address-to-ip-number-... or use google's geolocation app. regards
On Mon, Feb 6, 2012 at 1:53 PM, Peter Karunyu <pkarunyu@gmail.com> wrote:
Off the top of my head, I can think of two un-tested theoretical solutions:
If I understood you correct, you want to know which country a visitor is coming from?
If yes; then 1. Examine the Accept-Language HTTP header being sent by the visitors browsers, then do a simple comparison. The limitations of this are obvious, lots of countries will send the EN header. 2. Use the MaxMind GeIP web service @ $20 for 200,000 requests.
You may also be interested to know that there are some alternatives to MaxMind, as stated here.
On Mon, Feb 6, 2012 at 10:57 AM, Allan Ouma <aouma@ymail.com> wrote:
Hi Guys,
I need a little help with some PHP Code. There are several parts of my website where I want to include a particular PHP file depending on the location you access it from. For example, for the contacts information I have three different PHP files (kenya.php, nigeria.php, uk.php) I want to display specific contact information on my <div id="contacts"> depending on the location you access the website from. Any help on this? The current website is using another GeoLocation script that ade me design three different websites. Problem is, if you are accessing it from a different location, it will load the default website first then redirect you to the website for your location.
Can anyone help me with this please? Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya _______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

It is not exactly what I was looking for though... Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya
________________________________ From: Derrick Wesonga <wesongaderrick@gmail.com> To: Skunkworks Mailing List <skunkworks@lists.my.co.ke> Sent: Monday, February 6, 2012 4:26 PM Subject: Re: [Skunkworks] PHP GeoLocation Help
Try this http://www.justin-cook.com/wp/2006/11/28/convert-an-ip-address-to-ip-number-... or use google's geolocation app. regards
On Mon, Feb 6, 2012 at 1:53 PM, Peter Karunyu <pkarunyu@gmail.com> wrote:
Off the top of my head, I can think of two un-tested theoretical solutions:
If I understood you correct, you want to know which country a visitor is coming from?
If yes; then 1. Examine the Accept-Language HTTP header being sent by the visitors browsers, then do a simple comparison. The limitations of this are obvious, lots of countries will send the EN header. 2. Use the MaxMind GeIP web service @ $20 for 200,000 requests.
You may also be interested to know that there are some alternatives to MaxMind, as stated here.
On Mon, Feb 6, 2012 at 10:57 AM, Allan Ouma <aouma@ymail.com> wrote:
Hi Guys,
I need a little help with some PHP Code. There are several parts of my website where I want to include a particular PHP file depending on the location you access it from. For example, for the contacts information I have three different PHP files (kenya.php, nigeria.php, uk.php) I want to display specific contact information on my <div id="contacts"> depending on the location you access the website from. Any help on this? The current website is using another GeoLocation script that ade me design three different websites. Problem is, if you are accessing it from a different location, it will load the default website first then redirect you to the website for your location.
Can anyone help me with this please? Allan Ouma P.O. Box 12731 Nairobi 00400 Kenya _______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

Is the problem *When* you check your visitors address? -- * If the human brain were so simple that we could understand it, we would be so simple that we couldn't. - Emerson M. Pugh *

@Allan you can have a look at http://www.hostip.info/use.html (Old database) then you can write a simple script to recognize from which country the user is. -- Many Thanks. Regards, http://about.me/cnongera Clement Ongera.

Just came across this article <http://phpmaster.com/where-on-earth-are-you/>on PHPMaster.com, its about geolocation using WOEIDs, a free web service from Yahoo. On Tue, Feb 7, 2012 at 1:51 PM, Clement Ongera <cnongera@gmail.com> wrote:
@Allan you can have a look at http://www.hostip.info/use.html (Old database) then you can write a simple script to recognize from which country the user is.
-- Many Thanks.
Regards, http://about.me/cnongera Clement Ongera.
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Regards, Peter Karunyu -------------------
participants (5)
-
Allan Ouma
-
Clement Ongera
-
Derrick Wesonga
-
kris njoroge
-
Peter Karunyu