You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot access the RCODE returned by the DNS server #27
I found out that I need to know if a domain exists or not. According to the RFC 1035, it's the RCODE value that gives me this answer and can be one of :
https://www.rfc-editor.org/rfc/rfc1035
RCODE Response code - this 4 bit field is set as part of
responses. The values have the following
interpretation:
0 No error condition
1 Format error - The name server was
unable to interpret the query.
2 Server failure - The name server was
unable to process this query due to a
problem with the name server.
3 Name Error - Meaningful only for
responses from an authoritative name
server, this code signifies that the
domain name referenced in the query does
not exist.
4 Not Implemented - The name server does
not support the requested kind of query.
5 Refused - The name server refuses to
perform the specified operation for
policy reasons. For example, a name
server may not wish to provide the
information to the particular requester,
or a name server may not wish to perform
a particular operation (e.g., zone
I read the code and saw you extract the $rcode at line 515 in DNSQuery.php for debug purposes : $rcode = $this->header['spec'] & 15;
And never integrate it to DNSResult or DNSAnswer.
Is-it possible to add such data in the DNSAnswer object ? (I don't think the DNSResult need it)
In fact, I only need the raw data (but I'm not saying that a little enumeration could be really cool haha).
This has been addressed in the rcode branch #28 and merged back into master.
The DNSAnswer object now has the following methods:
DNSAnswer::setRcode(int): void sets the RCODE, DNSAnswer::getRCode():int returns the RCODE from the transaction (RCODE is initialised as -1 as a sanity check). DNSAnswer::getRcodeDescription(): string returns a brief textual status of the current RCODE (decided this was cleaner than creating a new class to store but could be re-factored).
Activity
purplepixie commentedon Sep 29, 2025
Welcome back :) I think this seems like a nice enhancement so I'll add it to the queue.
purplepixie commentedon Sep 29, 2025
This has been addressed in the rcode branch #28 and merged back into master.
The
DNSAnswerobject now has the following methods:DNSAnswer::setRcode(int): voidsets the RCODE,DNSAnswer::getRCode():intreturns the RCODE from the transaction (RCODE is initialised as -1 as a sanity check).DNSAnswer::getRcodeDescription(): stringreturns a brief textual status of the current RCODE (decided this was cleaner than creating a new class to store but could be re-factored).Example test code:
Produces:
@Legendary4226 please feel free to test this on the current master, once confirmed this meets your requirements I'll put it into a release.
Thanks again for your suggestion.
purplepixie commentedon Sep 29, 2025
Documentation: added RCODE into to usage document.
Legendary4226 commentedon Sep 29, 2025
I can easily access the RCODE as an int, that's perfect
Thank's you very much :)
purplepixie commentedon Sep 30, 2025
Released in 2.3.1