dns_get_record(): DNS query failed
1. Error: DNS_GET_RECORD(): DNS query failed. as shown in Figure 1
$records = dns_get_record($host, DNS_SRV);
2. Print the $HOST, the value is:https://object-wp.local/WP_ADMIN_USERNAME=admin
3. Open in the browser:https://object-wp.local/WP_ADMIN_USERNAME=admin, response 404. But surehttps://object-wp.localis supported. as shown in Figure 2
4. When starting with http://, the error is still reported: warning: dns_get_record(): dns query failed. as shown in Figure 3
<?php
$host = 'http://object-wp.local/WP_ADMIN_USERNAME=admin';
$records = dns_get_record($host, DNS_SRV);
?>
5. Open in the browser:http://object-wp.local/WP_ADMIN_USERNAME=admin, response 404. fixedhttps://object-wp.localis not supported. The web server is not listening on port 80. as shown in Figure 4
6. Reference can configure a server that handles both HTTP and HTTPS requests.https://nginx.org/en/docs/http/configuring_https_servers.html.
server {
listen 80;
listen 443 ssl;
}
7. Open in the browser:http://object-wp.local/WP_ADMIN_USERNAME=admin, response 404. But surehttp://object-wp.localalready supported. as shown in Figure 5
8. When starting with http://, the error is still reported: warning: dns_get_record(): dns query failed.
<?php
$host = 'http://object-wp.local/WP_ADMIN_USERNAME=admin';
$records = dns_get_record($host, DNS_SRV);
?>
9. When it does not start with http://, only pure domain names are left, and no errors are reported. The result is an empty array.
<?php
$host = 'object-wp.local';
$records = dns_get_record($host, DNS_SRV);
print_r($records);
?>
Array
(
)
10. When it does not start with http://, only the pure domain name is left, and the parameter is removed: dns_srv. No more errors. The result is not an empty array. as shown in Figure 6
<?php
$host = 'object-wp.local';
$records = dns_get_record($host);
print_r($records);
?>
Array
(
[0] => Array
(
[host] => object-wp.local
[class] => IN
[ttl] => 604800
[type] => A
[ip] => 127.0.0.1
)
)
11. From this, it can be confirmed that there are certain problems in the processing logic of program code. At least it means that the corresponding configuration of https:// is not supported.





