Last active
August 13, 2019 04:14
-
-
Save sanzeeb3/e7a3978f85b211e19d62b26b0ba860de to your computer and use it in GitHub Desktop.
Get all of the vulnerabilities that affect a particular plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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