federated-wordpress-customi.../rest-api/get_dns_records_test.php

28 lines
593 B
PHP
Raw Normal View History

<?php
2024-10-17 20:39:34 +00:00
if( ! defined( 'ABSPATH' ) ){
exit; // Exit if accessed directly.
}
add_action('rest_api_init', 'federated_route_get_dns');
function federated_route_get_dns(){
//register routes here
register_rest_route(
'federated-rest/v1',
'get-dns',
array(
'methods' => 'GET',
'callback' => 'federated_get_dns',
'permissions_callback' => 'check_federated_permissions'
)
);
}
function federated_get_dns($request){
$hostname = $request['hostname'];
$dns = dns_get_record($hostname);
return $dns;
}