Net_DNS_Resolver::rawQuery()
Synopsis
Net_DNS_Packet Net_DNS_Resolver::rawQuery (
string $hostname
, string $type = 'A'
, string $class = 'IN'
)
Description
-
hostname
- The name to lookup (eg. www.php.net) -
type
- The record type to query -
class
- The zone class to query
The Net_DNS_Resolver::rawQuery() function performs a DNS query similar to the Net_DNS_Resolver::query() function; however, rawQuery() will return any response from the nameserver. This is useful when the response packet may or may not contain any resource records in the "ANSWER" section.
rawQuery() uses the same resolver configuration used by Net_DNS_Resolver::query().
For a description of the returned RR data object, see Net_DNS_RR.
Example
Using Net_DNS_Resolver::rawQuery()
<?php
require_once 'Net/DNS.php';
$resolver = new Net_DNS_Resolver();
$response = $resolver->rawQuery('example.com');
if ($response) {
if (count($response->answer)) {
foreach ($response->answer as $rr) {
$rr->display();
}
}
}
?>
Output:
example.com. 129808 IN A 192.0.34.166
Note
This function can not be called statically.