Created
February 24, 2022 18:31
-
-
Save jonaslejon/b57021f47e66269ff0cad30a8dad6f26 to your computer and use it in GitHub Desktop.
WPSec.com PHP API
This file contains 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 | |
// Fetches a temporary access_token Bearer | |
// Replace the client_secret and client_id below | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'https://api.wpsec.com/oauth/token', | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => 'POST', | |
CURLOPT_POSTFIELDS => array('client_id' => '32','client_secret' => 'XXX','grant_type' => 'client_credentials'), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
echo $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment