Forum Moderators: coopster

Message Too Old, No Replies

Code By Country?

Is there a way? New to PHP

         

Jhet

8:54 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



Is there a way to have certain code execute based on what country the visitors are from?

Basically I want traffic from India or China to see one set of code and the rest to see another.

whoisgregg

9:41 pm on Jul 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is possible to geolocate the IP address of the visitor with varying degrees of accuracy. There are some free databases out there which will do an excellent job of telling you what country a visitor is from. Anything more specific than that and the accuracy starts to drop rapidly.

Basically, you get one of those databases then just compare the $_SERVER['REMOTE_ADDR'] value against the db.

Jhet

9:56 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



Soo many questions on that now. Are there any wordpress plugins that you know of that will do that? I guess that would be the easiest way for me.

Thank you for your answer!

Jhet

10:33 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



Ok NM. Your answer got me what I needed, whoisgregg. Thank you very much!

whoisgregg

12:21 pm on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Happy to help. :)