Get the location of iP and network operator
Applications used:7
Product services support payments in USD, HKD, and USDT
HTTP protocol:
http://api.youripapi.com/ipdata/
HTTPS protocol:
https://api.youripapi.com/ipdata/
* The API interface may be blocked due to various network reasons and attacks. Please make redundancy and exception handling during development
*If the status code returned by the HTTP request is not 200, perform an exception. For example, the status code 202 May be caused by invalid Token, insufficient balance, or incorrect format
iP query interface example for Java:
public class QueryHelper {
/**
* txt|jsonp|xml
*/
public static String DATATYPE="text";
public static String get(String urlString,String token) {
try {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setReadTimeout(5 * 1000);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(false);
conn.setRequestMethod("GET");
conn.setRequestProperty("token",token);
int responseCode = conn.getResponseCode();
if (responseCode == 200) {
StringBuilder builder = new StringBuilder();
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream(),"utf-8"));
for (String s = br.readLine(); s != null; s = br
.readLine()) {
builder.append(s);
}
br.close();
return builder.toString();
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static String queryIP(String ip){
String url="https://api.youripapi.com/ip/?ip="+ip+"&datatype="+DATATYPE;
String token="859476648b3de65d76804906dd1a1c6a";
return get(url,token);
}
}
// Here's an example:
// QueryHelper.queryIP("8.8.8.8");