add_action('wp_ajax_test_api_credentials', 'test_api_credentials');
function test_api_credentials() {
$credentials = json_decode(get_option('dmca_solve_google_api_credentials'), true);
if (empty($credentials)) {
echo 'No API credentials provided.';
wp_die();
}
require_once plugin_dir_path(__FILE__) . 'google-api-php-client/src/Google_Client.php';
$client = new Google_Client();
$client->setAuthConfig($credentials);
try {
$client->fetchAccessTokenWithAssertion();
if ($client->getAccessToken()) {
echo 'API credentials are valid.';
} else {
echo 'Failed to authenticate with provided credentials.';
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
wp_die();
}
Warning: Constant WP_DEBUG already defined in /home/fikfap/public_html/wp-config.php on line 88
Warning: Constant WP_DEBUG_LOG already defined in /home/fikfap/public_html/wp-config.php on line 89
Warning: Constant WP_DEBUG_DISPLAY already defined in /home/fikfap/public_html/wp-config.php on line 90