PHP code example of ljpc / pure-php-doh-client

1. Go to this page and download the library: Download ljpc/pure-php-doh-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ljpc / pure-php-doh-client example snippets



use LJPc\DoH\DNS;
use LJPc\DoH\DNSType;

ype::A() );
$answers = $result->getAnswers();
foreach ( $answers as $answer ) {
	echo $answer->value . "\n";
}


use LJPc\DoH\DNS;
use LJPc\DoH\DNSType;

Type::PTR() );
$answers = $result->getAnswers();
foreach ( $answers as $answer ) {
	echo $answer->value . "\n";
}


use LJPc\DoH\DNS;
use LJPc\DoH\DNSType;

MX() );
$answers = $result->getAnswers();
foreach ( $answers as $answer ) {
	echo '(' . $answer->extras['priority'] . ') ' . $answer->value . "\n";
}


use LJPc\DoH\DNS;
use LJPc\DoH\DNSType;
use LJPc\DoH\Servers\Quad9;

swers = $result->getAnswers();
echo "Used server: " . $result->getServer() . "\n";
foreach ( $answers as $answer ) {
	echo $answer->value . "\n";
}
json
"ljpc/pure-php-doh-client": "^1.0"