Change language

PHP Checkdnsrr () Function

Syntax:
bool checkdnsrr (string $host, string $type )
Parameters:This function takes two parameters as above and described below:
  • $host:Required parameter. It specifies the hostname or IP address to be verified.
  • $type:This is an optional parameter. Specifies the type of DNS record to check. Possible values: A, AAAA, A6, ANY, CNAME, MX (default), NAPTR, NS, PTR, SOA, SRV, TXT.
Returned value: this function returns TRUE if records are found, otherwise it returns FALSE.Notes :
  • This function is available for PHP 4.0. 0 and newer.
  • On Windows platforms, this function is available from PHP 5.3.0.
The following programs illustrate the checkdnsrr() function in PHP:Program 1: $domain = "engineerforgeks.org" ; if ( checkdnsrr ( $domain , "MX" )) { echo "Record exists." ; } else { echo "Record not found or error occured." ; }
?>
Output:
Record exists.
Program 2: $domain = "engineerforgeks.org" ; $arr = array ( "A" , "MX" , "NS" , "SOA" , "PTR" , "CNAME" , "AAAA" , "A6" , "SRV" , "NAPTR" , "TXT" , "ANY"); foreach ( $arr as $element ) { echo $element . ":" ; if ( checkdnsrr ( $domain , $element )) { echo "found
"
; } else { echo "not found
"
; } }  
?>
Output:
A: found MX: found NS: found SOA: found PTR: found CNAME: found AAAA: found A6: found SRV: found NAPTR: found TXT: found ANY: found
Link: https://www.php.net/manual/en/ function.checkdnsrr.php

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method