-
Notifications
You must be signed in to change notification settings - Fork 0
/
telize.cfc
36 lines (22 loc) · 1.27 KB
/
telize.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<cfcomponent hint="telize.com api cfml wrapper">
<cffunction name="init" access="public" output="false" hint="I initialize the component.">
<cfreturn this>
</cffunction>
<cffunction name="getIP" hint="This function gets the current ipaddress of client" output="no">
<cfargument name="json" default="" required="no" hint="Pass in json if you want JSON returned">
<cfset var API = structNew()>
<cfif arguments.json is not "json" and arguments.json is not ""><cfset arguments.json=""></cfif>
<cfhttp url="http://www.telize.com/#arguments.json#ip" result="API"></cfhttp>
<cfif arguments.json is "json">
<cfreturn deserializeJSON(API.filecontent)>
<cfelse>
<cfreturn API.filecontent>
</cfif>
</cffunction>
<cffunction name="getGeoIP" hint="This function gets the geo information of the passed in ipaddress. Defaults to ipaddress of client">
<cfargument name="IP" default="#cgi.REMOTE_ADDR#" hint="Ipaddress to get the information on.">
<cfset var API = structNew()>
<cfhttp url="http://www.telize.com/geoip/#arguments.ip#" result="API"></cfhttp>
<cfreturn deserializeJSON(API.filecontent)>
</cffunction>
</cfcomponent>