import requests
url = "URL"
response = requests.get(url).json()
print(response)
$url = "URL";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
const fetch = require('node-fetch');
const url = "URL";
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error));
const url = "URL";
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error));
import React, { useEffect } from 'react';
function App() {
useEffect(() => {
const url = "URL";
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error));
}, []);
return (
<div>
{/* Another component here */}
</div>
);
}
export default App;
<template>
<div>
<!-- Another component here -->
</div>
</template>
<script>
import axios from 'axios';
export default {
mounted() {
const url = "URL";
axios.get(url)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
}
}
</script>
require 'net/http'
require 'json'
url = "URL"
uri = URI(url)
response = Net::HTTP.get(uri)
data = JSON.parse(response)
puts data
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "URL"
response, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer response.Body.Close()
body, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Println("Error:", err)
return
}
var data interface{}
err = json.Unmarshal(body, &data)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println(data)
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
String url = "URL";
try {
URL apiUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
String jsonResponse = response.toString();
System.out.println(jsonResponse);
} else {
System.out.println("Error: " + responseCode);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
#include <iostream>
#include <curl/curl.h>
#include <jsoncpp/json/json.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* response) {
size_t totalSize = size * nmemb;
response->append(static_cast<char*>(contents), totalSize);
return totalSize;
}
int main() {
std::string url = "URL";
CURL* curl = curl_easy_init();
if (curl) {
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
CURLcode res = curl_easy_perform(curl);
if (res == CURLE_OK) {
Json::Value data;
Json::CharReaderBuilder reader;
std::istringstream jsonStream(response);
std::string parseErrors;
if (Json::parseFromStream(reader, jsonStream, &data, &parseErrors)) {
std::cout << data << std::endl;
} else {
std::cout << "Failed to parse JSON: " << parseErrors << std::endl;
}
} else {
std::cout << "Error: " << curl_easy_strerror(res) << std::endl;
}
curl_easy_cleanup(curl);
}
return 0;
}
A domain has a number of records associated with it, a DNS server can be queried to determine the IP address of the primary domain (A record), mail servers (MX records), DNS servers (NS nameservers) and other items such as SPF records (TXT records).
https://forestapi.vercel.app/api/dns/lookup/<domain>
Output :
{
"status": True,
"domain": "Domain",
"dns": {
"a": [
// IP Addresses
],
"ns": [
// Nameservers
],
"soa": {
"primary_ns": "Primary Nameserver",
"admin_email": "Admin Email",
"serial_number": "Serial Number"
}
}
}
A reverse DNS record (or PTR record) is simply an entry that resolves an IP address back to a host name. Most people are aware of the forward lookup, also known as an A record, that finds an IP address from a host name so an Internet service is able to be accessed.
https://forestapi.vercel.app/api/dns/reverse-lookup/<domain>
Output :
{
"status": True,
"domain": "Domain",
"ip_addresses": [
// IP Addresses
]
}
Find or look up information about the nameservers associated with a domain.
https://forestapi.vercel.app/api/dns/find-nameservers/<domain>
Output :
{
"status": True,
"domain": "Domain",
"nameservers": [
// Nameservers
]
}
Obtain public information about domain ownership and governance.
https://forestapi.vercel.app/api/dns/whois-lookup/<domain>
Output :
{
"status": True,
"domain": "Domain",
"whois": [
// List of Whois Lookup
]
}