// DNS-Abfrage mit PHP
$domain = 'example.com';
$type = 'A';
$url = 'https://tools.pph.sh/api.php?action=dns&domain=' . urlencode($domain) . '&type=' . urlencode($type) . '&format=json';
$response = file_get_contents($url);
$data = json_decode($response, true);
if ($data['success']) {
foreach ($data['records'] as $record) {
echo $record['ip'] . ' (TTL: ' . $record['ttl'] . ")\n";
}
}
// DNS-Abfrage mit JavaScript/Fetch API
const domain = 'example.com';
const type = 'A';
const url = `https://tools.pph.sh/api.php?action=dns&domain=${encodeURIComponent(domain)}&type=${encodeURIComponent(type)}&format=json`;
fetch(url)
.then(response => response.json())
.then(data => {
if (data.success) {
data.records.forEach(record => {
console.log(`${record.ip} (TTL: ${record.ttl})`);
});
}
})
.catch(error => console.error('Error:', error));
import requests
import urllib.parse
# DNS-Abfrage mit Python
domain = 'example.com'
record_type = 'A'
base_url = 'https://tools.pph.sh/api.php'
params = {
'action': 'dns',
'domain': domain,
'type': record_type,
'format': 'json'
}
url = f"{base_url}?{urllib.parse.urlencode(params)}"
response = requests.get(url)
data = response.json()
if data['success']:
for record in data['records']:
print(f"{record['ip']} (TTL: {record['ttl']})")
curl -X GET "https://tools.pph.sh/api.php?action=dns&domain=example.com&type=A&format=json"