bluebutterflyofyourmind Posted October 20, 2007 Share Posted October 20, 2007 hey there. just working on an assignment for a univeristy course. i'm rather new to php and would like to know how to determine where the viewer is from. ie. what country. so if they have a .ca i can display canadian funds, .com/.us american funds, and .uk for pounds. is there a function that can be used for this or is there a way to set the domain to a variable and extract it from there. (sorry is some terms are wrong. bear with me.) thanks! Quote Link to comment https://forums.phpfreaks.com/topic/74030-solved-how-to-determine-what-country-viewer-is-from/ Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 It sounds to me like you have a website with different domain names. In this case you just parse the url (check the server variable will have all you need, do a print r to see it's contents and work from that). Quote Link to comment https://forums.phpfreaks.com/topic/74030-solved-how-to-determine-what-country-viewer-is-from/#findComment-373699 Share on other sites More sharing options...
bluebutterflyofyourmind Posted October 20, 2007 Author Share Posted October 20, 2007 hmm. i see where your're coming from. but say for example, i'm in canada and i type in ecay.com, i get redirected to ebay.ca . how does ebay or any other e-commerce site determine where i'm from? Quote Link to comment https://forums.phpfreaks.com/topic/74030-solved-how-to-determine-what-country-viewer-is-from/#findComment-373702 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 There are a few ways. Based on the ip address (without being fully accurate) a php script can make a good guess at what region they are coming frmo (example demonoid.com detects canadian ip's and blocks them). Same idea. http://www.google.com/search?hl=en&q=get+users+location+with+php the first link will tell you everything you will need to know. Quote Link to comment https://forums.phpfreaks.com/topic/74030-solved-how-to-determine-what-country-viewer-is-from/#findComment-373704 Share on other sites More sharing options...
bluebutterflyofyourmind Posted October 20, 2007 Author Share Posted October 20, 2007 hey thanks or the help. all worked out Quote Link to comment https://forums.phpfreaks.com/topic/74030-solved-how-to-determine-what-country-viewer-is-from/#findComment-373935 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.