IP2Geo

From CDYNE Wiki
Revision as of 13:18, 10 December 2013 by imported>Bdriggers (VBScript Example)
Jump to navigation Jump to 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.

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=YOUR 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");
           
           if (String.IsNullOrWhiteSpace(ipr.City))
               Console.WriteLine("City: " + "No Information Found");
           else Console.WriteLine("City: " + ipr.City);
           if (String.IsNullOrWhiteSpace(ipr.StateProvince))
               Console.WriteLine("State: " + "No Information Found");
           else Console.WriteLine("State: " + ipr.StateProvince);
           if (String.IsNullOrWhiteSpace(ipr.Country))
               Console.WriteLine("Country: " + "No Information Found");
           else Console.WriteLine("Country: " + ipr.Country);
           if (String.IsNullOrWhiteSpace(ipr.Organization))
               Console.WriteLine("Organization: " + "No Information Found");
           else Console.WriteLine("Organization: " + ipr.Organization);
           Console.WriteLine("Latitude: " + ipr.Latitude);
           Console.WriteLine("Longitude: " + ipr.Longitude);
           if (String.IsNullOrWhiteSpace(ipr.AreaCode))
               Console.WriteLine("Area Code: " + "No Information Found");
           else Console.WriteLine("Area Code: " + ipr.AreaCode);
           if (String.IsNullOrWhiteSpace(ipr.TimeZone))
               Console.WriteLine("Time Zone: " + "No Information Found");
           else Console.WriteLine("Time Zone: " + ipr.TimeZone);
           Console.WriteLine("Daylight Savings: " + ipr.HasDaylightSavings);
           Console.WriteLine("Certainty: " + ipr.Certainty + "%");
           if (String.IsNullOrWhiteSpace(ipr.RegionName))
               Console.WriteLine("Region Name: " + "No Information Found");
           else Console.WriteLine("Region Name: " + ipr.RegionName);
           if (String.IsNullOrWhiteSpace(ipr.CountryCode))
               Console.WriteLine("Country Code: " + "No Information Found");
           else Console.WriteLine("Country Code: " + 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")
       If (String.IsNullOrWhiteSpace(IPR.City)) Then
           Console.WriteLine("City: " + "No Information Found")
       Else : Console.WriteLine("City: " + IPR.City)
       End If
       If (String.IsNullOrWhiteSpace(IPR.StateProvince)) Then
           Console.WriteLine("State: " + "No Information Found")
       Else : Console.WriteLine("State: " + IPR.StateProvince)
       End If
       If (String.IsNullOrWhiteSpace(IPR.Country)) Then
           Console.WriteLine("Country: " + "No Information Found")
       Else : Console.WriteLine("Country: " + IPR.Country)
       End If
       If (String.IsNullOrWhiteSpace(IPR.Organization)) Then
           Console.WriteLine("Organization: " + "No Information Found")
       Else : Console.WriteLine("Organization: " + IPR.Organization)
       End If
       Console.WriteLine("Latitude: " + IPR.Latitude.ToString())
       Console.WriteLine("Longitude: " + IPR.Longitude.ToString())
       If (String.IsNullOrWhiteSpace(IPR.AreaCode)) Then
           Console.WriteLine("Area Code: " + "No Information Found")
       Else : Console.WriteLine("Area Code: " + IPR.AreaCode)
       End If
       If (String.IsNullOrWhiteSpace(IPR.TimeZone)) Then
           Console.WriteLine("Time Zone: " + "No Information Found")
       Else : Console.WriteLine("Time Zone: " + IPR.TimeZone)
       End If
       Console.WriteLine("Daylight Savings: " + IPR.HasDaylightSavings.ToString())
       Console.WriteLine("Certainty: " + IPR.Certainty.ToString() + "%")
       If (String.IsNullOrWhiteSpace(IPR.RegionName)) Then
           Console.WriteLine("Region Name: " + "No Information Found")
       Else : Console.WriteLine("Region Name: " + IPR.RegionName)
       End If
       If (String.IsNullOrWhiteSpace(IPR.CountryCode)) Then
           Console.WriteLine("Country Code: " + "No Information Found")
       Else : Console.WriteLine("Country Code: " + IPR.CountryCode)
       End If
       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 for all CDYNE Web Services is based off a set monthly maintenance fee and a per-transaction fee. CDYNE does not require a contract and there are absolutely no start-up or cancellation fees. CDYNE services are post-pay. Your credit card will not be charged until one month from sign-up date and will be billed monthly thereafter unless you deactivate or cancel services. Net 30 billing is available upon application approval.

Calculate estimated monthly pricing

Service Trans. Min. Trans. Max. Monthly
IP2Geo Monthly Fee $20.00
IP2Geo Trans fee Zero 1,000 $0.0200
IP2Geo Trans fee 1,001 3,000 $0.0100
IP2Geo Trans fee 3,001 Unlimited $0.0090