import requests
login = "your_login"
password = "your_password"
hostname = "gw.dataimpulse.com"
port = 823
url = "http://ip-api.com/json"
proxy_url = f"http://{login}:{password}@{hostname}:{port}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
try:
response = requests.get(url, proxies=proxies, timeout=30)
response.raise_for_status()
data = response.json()
print(f"IP address: {data.get('query')}")
print(f"Country: {data.get('country')}")
print(f"State: {data.get('regionName')}")
print(f"City: {data.get('city')}")
print(f"Zipcode: {data.get('zip')}")
print(f"ASN: {data.get('as')}")
print(f"Status: {data.get('status')}")
except Exception as e:
print(f"Error: {e}")
const axios = require("axios");
const { HttpProxyAgent } = require("http-proxy-agent");
const { HttpsProxyAgent } = require("https-proxy-agent");
const login = "your_login";
const password = "your_password";
const hostname = "gw.dataimpulse.com";
const port = 823;
const proxyUrl = `http://${encodeURIComponent(login)}:${encodeURIComponent(password)}@${hostname}:${port}`;
const httpAgent = new HttpProxyAgent(proxyUrl);
const httpsAgent = new HttpsProxyAgent(proxyUrl);
(async () => {
try {
const response = await axios.get("http://ip-api.com/json", {
httpAgent,
httpsAgent,
proxy: false,
timeout: 30000
});
const data = response.data;
console.log(`IP address: ${data.query}`);
console.log(`Country: ${data.country}`);
console.log(`State: ${data.regionName}`);
console.log(`City: ${data.city}`);
console.log(`Zipcode: ${data.zip}`);
console.log(`ASN: ${data.as}`);
console.log(`Status: ${data.status}`);
} catch (error) {
console.error("Error:", error.message);
}
})();
<?php
$login = "your_login";
$password = "your_password";
$hostname = "gw.dataimpulse.com";
$port = 823;
$url = "http://ip-api.com/json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_PROXY, $hostname);
curl_setopt($ch, CURLOPT_PROXYPORT, $port);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $login . ":" . $password);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo "Error: " . curl_error($ch) . PHP_EOL;
curl_close($ch);
exit;
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
echo "Error: HTTP " . $httpCode . PHP_EOL;
exit;
}
$data = json_decode($response, true);
echo "IP address: " . ($data['query'] ?? '') . PHP_EOL;
echo "Country: " . ($data['country'] ?? '') . PHP_EOL;
echo "State: " . ($data['regionName'] ?? '') . PHP_EOL;
echo "City: " . ($data['city'] ?? '') . PHP_EOL;
echo "Zipcode: " . ($data['zip'] ?? '') . PHP_EOL;
echo "ASN: " . ($data['as'] ?? '') . PHP_EOL;
echo "Status: " . ($data['status'] ?? '') . PHP_EOL;
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Program
{
static async Task Main()
{
string login = "your_login";
string password = "your_password";
string hostname = "gw.dataimpulse.com";
int port = 823;
var proxy = new WebProxy(hostname, port)
{
Credentials = new NetworkCredential(login, password)
};
var handler = new HttpClientHandler
{
Proxy = proxy,
UseProxy = true
};
using var client = new HttpClient(handler);
client.Timeout = TimeSpan.FromSeconds(30);
try
{
var response = await client.GetAsync("http://ip-api.com/json");
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
var data = JObject.Parse(json);
Console.WriteLine($"IP address: {data["query"]}");
Console.WriteLine($"Country: {data["country"]}");
Console.WriteLine($"State: {data["regionName"]}");
Console.WriteLine($"City: {data["city"]}");
Console.WriteLine($"Zipcode: {data["zip"]}");
Console.WriteLine($"ASN: {data["as"]}");
Console.WriteLine($"Status: {data["status"]}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
package main
import (
"encoding/json"
"fmt"
"net"
"net/http"
"net/url"
"time"
)
func main() {
login := "your_login"
password := "your_password"
hostname := "gw.dataimpulse.com"
port := "823"
targetURL := "http://ip-api.com/json"
proxyStr := fmt.Sprintf("http://%s:%s@%s:%s",
url.QueryEscape(login),
url.QueryEscape(password),
hostname,
port,
)
proxyURL, err := url.Parse(proxyStr)
if err != nil {
fmt.Println("Proxy parse error:", err)
return
}
transport := &http.Transport{
Proxy: http.ProxyURL(proxyURL),
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
}).DialContext,
}
client := &http.Client{
Transport: transport,
Timeout: 30 * time.Second,
}
resp, err := client.Get(targetURL)
if err != nil {
fmt.Println("Request error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
fmt.Println("HTTP error:", resp.Status)
return
}
var data map[string]interface{}
err = json.NewDecoder(resp.Body).Decode(&data)
if err != nil {
fmt.Println("JSON decode error:", err)
return
}
fmt.Printf("IP address: %v\n", data["query"])
fmt.Printf("Country: %v\n", data["country"])
fmt.Printf("State: %v\n", data["regionName"])
fmt.Printf("City: %v\n", data["city"])
fmt.Printf("Zipcode: %v\n", data["zip"])
fmt.Printf("ASN: %v\n", data["as"])
fmt.Printf("Status: %v\n", data["status"])
}
require 'net/http'
require 'json'
require 'uri'
login = 'your_login'
password = 'your_password'
hostname = 'gw.dataimpulse.com'
port = 823
url = URI('http://ip-api.com/json')
http = Net::HTTP::Proxy(hostname, port, login, password).new(url.host, url.port)
http.open_timeout = 30
http.read_timeout = 30
request = Net::HTTP::Get.new(url)
begin
response = http.request(request)
unless response.is_a?(Net::HTTPSuccess)
puts "Error: HTTP #{response.code}"
exit
end
data = JSON.parse(response.body)
puts "IP address: #{data['query']}"
puts "Country: #{data['country']}"
puts "State: #{data['regionName']}"
puts "City: #{data['city']}"
puts "Zipcode: #{data['zip']}"
puts "ASN: #{data['as']}"
puts "Status: #{data['status']}"
rescue => e
puts "Error: #{e.message}"
end
curl -s -x http://login:[email protected]:823 http://ip-api.com/json | jq -r '
"IP address: \(.query)
Country: \(.country)
State: \(.regionName)
City: \(.city)
Zipcode: \(.zip)
ASN: \(.as)
Status: \(.status)"
'