Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfhttp url="http://freegeoip.net/xml/#cgi.remote_addr#" name="results" method="get" delimiter="#chr(10)#" />
- <cfset colname = results.columnlist> <!--- there's only one column and its name isn't something we can reference it by --->
- <cfset x = 0>
- <cfset a = []>
- <!--- <cfdump var="#results#"> Uncomment this to see the list of everything you can check for. --->
- <cfloop query="#results#">
- <cfset x = x + 1>
- <cfset a[x] = results[colname]>
- <cfif a[x] contains "Latitude">
- <cfset mylat = REReplaceNoCase(a[x], "<[^[:space:]][^>]*>", "", "ALL")>
- </cfif>
- <cfif a[x] contains "Longitude">
- <cfset mylon = REReplaceNoCase(a[x], "<[^[:space:]][^>]*>", "", "ALL")>
- </cfif>
- <cfif a[x] contains "CountryCode">
- <cfset country = REReplaceNoCase(a[x], "<[^[:space:]][^>]*>", "", "ALL")>
- </cfif>
- </cfloop>
- <cfif country eq "AU">
- <cflocation url="http://www.someplaceelse.com" addtoken="no">
- </cfif>
Add Comment
Please, Sign In to add comment