IP2Geo

From CDYNE Wiki
Jump to: navigation, search

Web Personalization for One-to-One Web Marketing

The IP2Geo® Web Service resolves IP addresses to Network Owner Name, City, State/Province, and Country. In most U.S. cities, it will also provide extra information such as Area Code and Latitude/Longitude. This service allows for the integration of location & distance information and other geographic intelligence into your application databases, business processes and web sites.

IP2Geo gives you easy access to numerous data points that you can use to impress your clients. From geographically customized menus to log file analysis, your targeted site visitors will be impressed when they see specific information on their location. The real-time technology can even be used to trigger special "preferred location" promotions.

This service is also used to validate users by IP address to weed out hackers and other fraudsters.

All of CDYNE's Web services are built on XML standards and are delivered via a secure Internet connection. This real-time Web service dynamically delivers value-added information at the point of customer interaction or to the client database for true enterprise intelligence, positively affecting the quality of resultant analytics, customer relationships and the bottom line.

Contents

DEVELOPER RESOURCES

General Information

IP2Geo - IP Address to Geographic information.

Developer/Tester Information

PHP Example

<?php
 
// Create a new soap client
$client = new SoapClient('http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl');
 
$param = array(
'ipAddress' => 'IP ADDRESS',
'licenseKey' => 'YOUR LICENSE KEY',
);
 
$result = $client->ResolveIP($param);
 
// View the response from CDYNE
print_r ($result);
 
?>

JAVA Example

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
 
public final class ResolveIP{
public static void main(String[] args) {
 
try{
URL url = new URL("http://ws.cdyne.com/ip2geo/ip2geo.asmx/ResolveIP?"
+ "ipAddress=IP ADDRESS"
+ "&licenseKey=YOUR LICENSE KEY");
try{
InputStream in = url.openStream();
StreamSource source = new StreamSource(in);
printResult(source);
}catch(java.io.IOException e){
e.printStackTrace();
}
}catch (MalformedURLException e){
e.printStackTrace();
}
}
private static void printResult(Source source) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult sr = new StreamResult(bos);
Transformer trans = TransformerFactory.newInstance().newTransformer();
Properties oprops = new Properties();
oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperties(oprops);
trans.transform(source, sr);
System.out.println("**** Response ******");
System.out.println(bos.toString());
 
bos.close();
System.out.println();
} catch (Exception e) {
}
}
}

VBScript Example

Dim request, oXMLHttp, url
url = "http://ws.cdyne.com/ip2geo/ip2geo.asmx"
 
request = "<?xml version='1.0' encoding='utf-8'?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soap:Body>" & _
"<ResolveIP xmlns=""http://ws.cdyne.com/"">" & _
"<ipAddress>IP ADDRESS</ipAddress>" & _
"<licenseKey>YOUR LICENSE KEY</licenseKey>" & _
"</ResolveIP>" & _
"</soap:Body>" & _
"</soap:Envelope>"
 
Set oXMLHttp = CreateObject("MSXML2.ServerXMLHTTP")
oXMLHttp.open "POST", url, False
oXMLHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
oXMLHttp.send request
response = oXMLHttp.responseText
 
MsgBox oXMLHTTP.responseText

CSharp Example

/*http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl was added as a Web Reference and given the name WSDL*/
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IP2Geo.WSDL;
namespace IP2Geo
{
class Program
{
static void Main(string[] args)
{
WSDL.IP2Geo ip = new WSDL.IP2Geo();
WSDL.IPInformation ipr = ip.ResolveIP("IP ADDRESS", "YOUR LICENSE KEY");
 
Console.WriteLine("City: " + (String.IsNullOrEmpty(ipr.City) ? "No Information Found" : ipr.City));
Console.WriteLine("State: " + (String.IsNullOrEmpty(ipr.StateProvince) ? "No Information Found" : ipr.StateProvince));
Console.WriteLine("Country: " + (String.IsNullOrEmpty(ipr.Country) ? "No Information Found" : ipr.Country));
Console.WriteLine("Organization: " + (String.IsNullOrEmpty(ipr.Organization) ? "No Information Found" : ipr.Organization));
Console.WriteLine("Latitude: " + ipr.Latitude);
Console.WriteLine("Longitude: " + ipr.Longitude);
Console.WriteLine("Area Code: " + (String.IsNullOrEmpty(ipr.AreaCode) ? "No Information Found" : ipr.AreaCode));
Console.WriteLine("Time Zone: " + (String.IsNullOrEmpty(ipr.TimeZone) ? "No Information Found" : ipr.TimeZone));
Console.WriteLine("Daylight Savings: " + ipr.HasDaylightSavings);
Console.WriteLine("Certainty: " + ipr.Certainty + "%");
Console.WriteLine("Region Name: " + (String.IsNullOrEmpty(ipr.RegionName) ? "No Information Found" : ipr.RegionName));
Console.WriteLine("Country Code: " + (String.IsNullOrEmpty(ipr.CountryCode) ? "No Information Found" : ipr.CountryCode));
 
Console.ReadLine();
}
}
}

VB.Net Example

'http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl was added as a Web Reference and given the name WSDL
 
Imports ResolveIP.WSDL
Module Module1
 
Sub Main()
Dim IP As New IP2Geo()
Dim IPR = IP.ResolveIP("IP ADDRESS", "YOUR LICENSE KEY")
 
Console.WriteLine("City: " & (If(String.IsNullOrEmpty(IPR.City), "No Information Found", IPR.City)))
Console.WriteLine("State: " & (If(String.IsNullOrEmpty(IPR.StateProvince), "No Information Found", IPR.City)))
Console.WriteLine("Country: " & (If(String.IsNullOrEmpty(IPR.Country), "No Information Found", IPR.Country)))
Console.WriteLine("Organization: " & (If(String.IsNullOrEmpty(IPR.Organization), "No Information Found", IPR.Organization)))
Console.WriteLine("Latitude: " & IPR.Latitude)
Console.WriteLine("Longitude: " & IPR.Longitude)
Console.WriteLine("Area Code: " & (If(String.IsNullOrEmpty(IPR.AreaCode), "No Information Found", IPR.Organization)))
Console.WriteLine("Time Zone: " & (If(String.IsNullOrEmpty(IPR.TimeZone), "No Information Found", IPR.TimeZone)))
Console.WriteLine("Daylight Savings: " & IPR.HasDaylightSavings)
Console.WriteLine("Certainty: " & IPR.Certainty & "%")
Console.WriteLine("Region Name: " & (If(String.IsNullOrEmpty(IPR.RegionName), "No Information Found", IPR.RegionName)))
Console.WriteLine("Country Code: " & (If(String.IsNullOrEmpty(IPR.CountryCode), "No Information Found", IPR.CountryCode)))
 
Console.ReadLine()
 
End Sub
 
End Module

Web Service source code examples

JSP
Flash
CFM
ASP.NET
ASP
PHP

LICENSE KEYS AND PRICING

Free Trial License Keys

  • CDYNE offers trial license keys for all Web Services so that you may test the APIs for free.
  • Trial keys do not expire, and are limited to approximately 50 transactions.
  • Normal processing time for trial key requests during normal business hours (M-F, 9-6 eastern) typically ranges from ten minutes to two hours.
  • Sign up here for a free trial IP2Geo license key.

Production (Account) License Keys

  • Sign up here for a production IP2Geo license key.
  • Upon registration, your account will be suspended for verification by default.
  • The account verification process takes less than one business day to complete for account activation.
  • You may call 1-800-984-3710 to expedite the verification process over the phone.

Pricing

Pricing

Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key