diff --git a/html/includes/forms/query-ripenccapi.inc.php b/html/includes/forms/query-ripenccapi.inc.php new file mode 100644 index 0000000000..dd62474f53 --- /dev/null +++ b/html/includes/forms/query-ripenccapi.inc.php @@ -0,0 +1,30 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +$status = 'error'; +$message = 'unknown error'; +$parameter = mres($_POST['parameter']); +if (isset($parameter)) { + $status = 'ok'; + $message = 'Queried'; + $output = get_ripe_api_whois_data_json($parameter); +} +else { + $status = 'error'; + $message = 'ERROR: Could not query'; +} +die(json_encode(array( + 'status' => $status, + 'message' => $message, + 'parameter' => $parameter, + 'output' => $output +))); diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 21121d0cef..7d8e4d37e6 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1249,3 +1249,9 @@ function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$it } return $output; }//end generate_dynamic_config_panel() + +function get_ripe_api_whois_data_json($ripe_parameter) { + $ripe_whois_url = 'https://stat.ripe.net/data/whois/data.json?resource=' . $ripe_parameter; + return json_decode(file_get_contents($ripe_whois_url) , true); +}//end get_ripe_api_whois_data_json() + diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 09d4b57b76..e61990ea03 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -74,6 +74,12 @@ if ($_SESSION['userlevel'] >= '10') {