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

24 lines
520 B
PHP
Raw Normal View History

<?php
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;
}