GET/POST Request
Base URL:
https://skwebuild.in/API/geolocation/
Request:
Curl
curl -X POST https://www.skwebuild.in/API/geolocation -H "Content-Type: application/json" -d "{\"api_key\":\"API KEY\",\"ip_addr\":\"USER IP\"}"
PHP
$headers = array( "Content-Type: application/json", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = '{"api_key":"API KEY","ip_addr":"USER IP"}'; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); //for debug only! curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $resp = curl_exec($curl); curl_close($curl); var_dump($resp); ?>
Python
import requests from requests.structures import CaseInsensitiveDict url = "https://www.skwebuild.in/API/geolocation" headers = CaseInsensitiveDict() headers["Content-Type"] = "application/json" data = '{"api_key":"API KEY","ip_addr":"USER IP"}' resp = requests.post(url, headers=headers, data=data) print(resp.status_code)
Java
URL url = new URL("https://www.skwebuild.in/API/geolocation"); HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setRequestMethod("POST"); http.setDoOutput(true); http.setRequestProperty("Content-Type", "application/json"); String data = "{\"api_key\":\"API KEY\",\"ip_addr\":\"USER IP\"}"; byte[] out = data.getBytes(StandardCharsets.UTF_8); OutputStream stream = http.getOutputStream();
Javascript / Ajax
var url = "https://www.skwebuild.in/API/geolocation"; var xhr = new XMLHttpRequest(); xhr.open("POST", url); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { console.log(xhr.status); console.log(xhr.responseText); }}; var data = '{"api_key":"API KEY","ip_addr":"USER IP"}'; xhr.send(data);
C# / .NET
var url = "https://www.skwebuild.in/API/geolocation"; var httpRequest = (HttpWebRequest)WebRequest.Create(url); httpRequest.Method = "POST"; httpRequest.ContentType = "application/json"; var data = "{\"api_key\":\"API KEY\",\"ip_addr\":\"USER IP\"}"; using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream())) { streamWriter.Write(data); } var httpResponse = (HttpWebResponse)httpRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } Console.WriteLine(httpResponse.StatusCode);
Response:
JSON: {"status":"success","country":"India","countryCode":"IN","region":"GJ","regionName":"Gujarat","city":"Gandhinagar","zip":"382006","lat":23.2167,"lon":72.6833,"timezone":"Asia/Kolkata","isp":"Gtpl JAY Mataji Network Pvt. Ltd.","org":"Gtpl Broadband Pvt. Ltd.","as":"AS45916 Gujarat Telelink Pvt Ltd","query":"IP"}