Change language

PHP Dns_check_record () function

Note.This function is an alias for the checkdnsrr() function.Syntax:
bool dns_check_record (string $host, string $type)
Parameters:this function takes two parameters as specified above and described below:
  • $host:Required. 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 (dns_check_record ( $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 (dns_check_record ( $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. dns-check-record.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

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