mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
Merge pull request #10 from asimzeeshan/main
Updating calls.php to fix GET statement
This commit is contained in:
commit
a91d787e3e
16
class.php
16
class.php
@ -3057,11 +3057,19 @@ class idlers extends helperFunctions
|
|||||||
|
|
||||||
public function getIpForDomain(string $domain, string $type = 'A'): string
|
public function getIpForDomain(string $domain, string $type = 'A'): string
|
||||||
{//Gets IP from A record for a domain
|
{//Gets IP from A record for a domain
|
||||||
$data = json_decode(file_get_contents("https://whatsmydns.net/api/details?server=428&type=$type&query=$domain"), true);
|
switch ($type) {
|
||||||
if (isset($data['data'][0]['response'][0])) {
|
case "A":
|
||||||
if (strlen($data['data'][0]['response'][0]) > 6) {
|
$data = dns_get_record($domain, DNS_A);
|
||||||
return $data['data'][0]['response'][0];
|
if (isset($data['0']['ip'])) {
|
||||||
|
return $data['0']['ip'];
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "AAAA":
|
||||||
|
$data = dns_get_record($domain, DNS_AAAA);
|
||||||
|
if (isset($data['0']['ipv6'])) {
|
||||||
|
return $data['0']['ipv6'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return "";//Doesnt exist/null/empty/invalid
|
return "";//Doesnt exist/null/empty/invalid
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user