Use a public geo-location service:

<cfhttp method="get"
URL="http://ipinfodb.com/ip_query.php?ip=#cgi.REMOTE_ADDR#";
result="response" />

Then use the response XML tree to extract the country or zip:

<cfset xmmm = xmlparse(response.filecontent)>
<cfset countryname = xmmm.response.countryname.xmltext>

<cfif countryname neq "Canada">
<div id=price">#price#</div>
</cfif>

I wouldn't actually do it in this order because of the lag in http
posts. I've had good luck with this method but it isn't perfect
because web services can go down and then your checking system breaks.
If the location service isn't working, then don't allow anyone to use
the module you've built with the integrated geo-location service. Use
cookies as you stated to keep from having to do this every time.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339440
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to