Examples below show how to use the MaxMind Proxy Detection web service API from server-side scripts in Perl, ASP and PHP.
These can be adapted for other web services.
Any programming language that supports HTTP client calls should be able to use MaxMind web services.
Perl Example
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use HTTP::Request qw(GET POST);
use HTTP::Headers;
# replace this value with license key
my $license_key = "LICENSE_KEY_HERE";
my $ua = LWP::UserAgent->new(timeout => 2);
my $h = HTTP::Headers->new;
$h->content_type('application/x-www-form-urlencoded');
my $request = HTTP::Request->new('POST','https://minfraud3.maxmind.com/app/ipauth_http',
$h,"l=$license_key&ipaddr=80.24.24.24");
my $res = $ua->request($request);
my $content = $res->content;
print "content = $content\n"
|
|
Active Server Pages (ASP) Example
Dim objHttp, strQuery
strQuery = "https://minfraud3.maxmind.com/app/ipauth_http?l=" & license_key & _
"&ipaddr=" & ipaddress
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "GET", strQuery, false
objHttp.send
Response.Write objHttp.ResponseText
Set objHttp = Nothing
|
|
Requirements:
- ASP 3.0+
- Microsoft® XML 3.0 Component
Microsoft XML 3.0 Component can be downloaded for free from
here.
PHP Example
#!/usr/bin/php -q
<?php
$license_key = 'LICENSE_KEY_HERE';
$ipaddress = 'IP_ADDRESS_HERE';
$query = "https://minfraud3.maxmind.com/app/ipauth_http?l=" . $license_key
. "&ipaddr=" . $ipaddress;
$score = file_get_contents($query);
echo $score;
?>