<?php
$endpoint = 'https://openapibox.com/api/domainwhois/YOUR-API-KEY/getInfo';
$domain = 'example.com';
$params = [
'domain' => $domain
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $endpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'cURL error: ' . curl_error($curl);
} else {
echo htmlentities($response);
}
curl_close($curl);
?>
<?php
use GuzzleHttp\Client;
$client = new Client();
$endpoint = 'https://openapibox.com/api/domainwhois/YOUR-API-KEY/getInfo';
$domain = 'example.com';
$params = [
'domain' => $domain
];
try {
$response = $client->post($endpoint, [
'form_params' => $params
]);
echo htmlentities($response->getBody());
} catch (\GuzzleHttp\Exception\RequestException $e) {
echo 'Guzzle error: ' . $e->getMessage();
}
?>
const axios = require('axios');
const querystring = require('querystring');
const domain = 'example.com';
const endpoint = 'https://openapibox.com/api/domainwhois/YOUR-API-KEY/getInfo';
const data = {
domain: domain
};
axios.post(endpoint, querystring.stringify(data))
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
import requests
domain = 'example.com'
endpoint = 'https://openapibox.com/api/domainwhois/YOUR-API-KEY/getInfo'
payload = {
'domain': domain
}
try:
response = requests.post(endpoint, data=payload)
print(response.text)
except requests.exceptions.RequestException as e:
print('Error:', e)
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
func main() {
// Set the domain and API Key
domain := "example.com" // Replace with the domain you want to query WHOIS info for
endpoint := "https://openapibox.com/api/domainwhois/YOUR-API-KEY/getInfo" // Replace with your actual endpoint
// Set the data to be sent in the POST request
data := url.Values{}
data.Set("domain", domain) // Use "domain" instead of "ip"
// Create a POST request
req, err := http.NewRequest("POST", endpoint, bytes.NewBufferString(data.Encode()))
if err != nil {
log.Fatal(err)
}
// Set the Content-Type header to application/x-www-form-urlencoded
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
// Send the request using the HTTP client
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
// Read and print the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(body))
}