get Options value in "external" page

I’ve create a really small plugin. This plugin add one filter :

add_filter(‘the_content’, ‘BlueSteelAPI’, 5);

BlueSteelAPI is calling my API. I’ve create an admin page for register the secret key password. That’s Ok.

But, in my plugin directory, i’ve this other page :

The goal of this page is to receive some Post Data and send it to my API for get a reference for a command.

But, “$secretKey” is in the “Options” table of wordpress. How can I get this data?

I can make a query like “select option_value from options where option_name = ‘secretKey'”

But, is there a better way to get this data?


I’ve find this solution but i think, it’s not really nice. I’ve put it in the top my other page…

require( ‘../../../wp-blog-header.php’);

$option = $wpdb->get_results(‘SELECT * FROM ‘. $wpdb->prefix.’options where option_name in (‘bluesteel_secretkey’, ‘bluesteel_sitekey’)’);
$secretKey = $option[0]->option_value;
$apiKey = $option[1]->option_value;