Skip to content

Instantly share code, notes, and snippets.

@sanzeeb3
Last active August 13, 2019 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanzeeb3/e7a3978f85b211e19d62b26b0ba860de to your computer and use it in GitHub Desktop.
Save sanzeeb3/e7a3978f85b211e19d62b26b0ba860de to your computer and use it in GitHub Desktop.
Get all of the vulnerabilities that affect a particular plugin
<?php
/**
* Get all of the vulnerabilities that affect a particular plugin
* @see https://wpvulndb.com/api
*
* @return void.
*/
function wpvul_api_call() {
$api_call = 'https://wpvulndb.com/api/v3/plugins/plugin-slug';
$header = array(
'headers' => "Authorization: Token token=access_token"
);
$data = wp_remote_get( $api_call, $header );
$code = wp_remote_retrieve_response_code( $data );
$body = wp_remote_retrieve_body( $data );
$result = json_decode( $body );
error_log( print_r( $result, true ) );
}
add_action( 'init', 'wpvul_api_call' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment