Get Started With IP2Proxy Haskell Module
Dependencies
This library requires IP2Proxy BIN database to function. You may download the BIN database at
IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com
Installation
To install this module type the following:
cabal install IP2Proxy
Sample Codes
Query geolocation information from BIN database
You can query the geolocation information from the IP2Proxy BIN database as below:
import IP2Proxy
main :: IO ()
main = do
let myfile = "./IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER-FRAUDSCORE.BIN"
let ip = "197.85.191.64"
meta <- open myfile
putStrLn $ "module_version: " ++ getModuleVersion
putStrLn $ "package_version: " ++ (getPackageVersion meta)
putStrLn $ "database_version: " ++ (getDatabaseVersion meta)
result <- getAll myfile meta ip
putStrLn $ "country_short: " ++ (show (country_short result))
putStrLn $ "country_long: " ++ (show (country_long result))
putStrLn $ "region: " ++ (show (region result))
putStrLn $ "city: " ++ (show (city result))
putStrLn $ "isp: " ++ (show (isp result))
putStrLn $ "proxy_type: " ++ (show (proxy_type result))
putStrLn $ "domain: " ++ (show (domain result))
putStrLn $ "usage_type: " ++ (show (usage_type result))
putStrLn $ "asn: " ++ (show (asn result))
putStrLn $ "as: " ++ (show (as result))
putStrLn $ "last_seen: " ++ (show (last_seen result))
putStrLn $ "threat: " ++ (show (threat result))
putStrLn $ "provider: " ++ (show (provider result))
putStrLn $ "fraud_score: " ++ (show (fraud_score result))
putStrLn $ "is_proxy: " ++ (show (is_proxy result))
result <- getCountryShort myfile meta ip
putStrLn $ "country_short: " ++ result
result <- getCountryLong myfile meta ip
putStrLn $ "country_long: " ++ result
result <- getRegion myfile meta ip
putStrLn $ "region: " ++ result
result <- getCity myfile meta ip
putStrLn $ "city: " ++ result
result <- getISP myfile meta ip
putStrLn $ "isp: " ++ result
result <- getProxyType myfile meta ip
putStrLn $ "proxy_type: " ++ result
result <- getDomain myfile meta ip
putStrLn $ "domain: " ++ result
result <- getUsageType myfile meta ip
putStrLn $ "usage_type: " ++ result
result <- getASN myfile meta ip
putStrLn $ "asn: " ++ result
result <- getAS myfile meta ip
putStrLn $ "as: " ++ result
result <- getLastSeen myfile meta ip
putStrLn $ "last_seen: " ++ result
result <- getThreat myfile meta ip
putStrLn $ "threat: " ++ result
result <- getProvider myfile meta ip
putStrLn $ "provider: " ++ result
result <- getFraudScore myfile meta ip
putStrLn $ "fraud_score: " ++ result
result <- isProxy myfile meta ip
putStrLn $ "is_proxy: " ++ result
IP2Proxy Sample Database (BIN)
| Sample Packages - BIN File | IPv4 + IPv6 |
|---|---|
| IP2Proxy PX1 | Download (391.15 kB) |
| IP2Proxy PX2 | Download (406.80 kB) |
| IP2Proxy PX3 | Download (436.24 kB) |
| IP2Proxy PX4 | Download (471.65 kB) |
| IP2Proxy PX5 | Download (491.98 kB) |
| IP2Proxy PX6 | Download (494.79 kB) |
| IP2Proxy PX7 | Download (536.04 kB) |
| IP2Proxy PX8 | Download (542.17 kB) |
| IP2Proxy PX9 | Download (542.01 kB) |
| IP2Proxy PX10 | Download (673.87 kB) |
| IP2Proxy PX11 | Download (680.81 kB) |
| IP2Proxy PX12 | Download (685.90 kB) |