Difference between revisions of "IP2Geo"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Bdriggers
(CSharp Example)
imported>Bdriggers
(VBSCript Example)
Line 189: Line 189:
 
</code>
 
</code>
  
=== VBSCript Example ===
+
=== VBScript Example ===
 
<code type=vbscript>
 
<code type=vbscript>
  

Revision as of 11:49, 10 December 2013

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> class IP2Geo { private $ip; private $license; public $response;

	public function __construct($ip,$license) 

{ $this->license = $license; $this->ip = $ip; $response = $this->getResponse(); }

public function getResponse() { $url = "http://ws.cdyne.com/ip2geo/ip2geo.asmx/ResolveIP"; $url .= "?ipAddress=" . $this->ip . "&licenseKey=" . $this->license; $this->response = simplexml_load_file($url) or die("ERROR"); }

}
function getRealIP() {
  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
   	$ip=$_SERVER['HTTP_CLIENT_IP'];
  } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  	$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
 $ip=$_SERVER['REMOTE_ADDR'];
}
 return $ip;

}

$ip = getRealIP();
$key = 'XXXXXXXXXXXXXXXXXXXX;
$data = new IP2Geo($ip,$key);
var_dump($data);
</php>

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>YOUR 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("YOUR 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();
       }
   }

}

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>218101280</ipAddress>" & _ "<licenseKey>918a43d3-8040-4d1c-b591-b184a1c11f84</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

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