24 lines
520 B
PHP
24 lines
520 B
PHP
|
<?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;
|
||
|
}
|