Examples
Example code for various languages.
You might also like to check out our
SDKs
Perl Example
Note:
This is a minimal 'cut and paste' example demonstrating the IP Info API.
This example does not include any error handling or validation of response data.
use LWP::UserAgent;
use URI::Escape;
use JSON;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => "https://neutrinoapi.net/ip-info");
$req->content_type("application/x-www-form-urlencoded");
$req->content(
"user-id=".uri_escape("YOUR_USER_ID")."&".
"api-key=".uri_escape("YOUR_API_KEY")."&".
"ip=".uri_escape("162.209.104.195")
);
my $resp = $ua->request($req);
$result = decode_json($resp->content);
print $result->{"country"} . "\n";
print $result->{"country-code"} . "\n";
print $result->{"region"} . "\n";
print $result->{"city"} . "\n";