Skip to content

Instantly share code, notes, and snippets.

@jonaslejon
Created February 24, 2022 18:31
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 jonaslejon/b57021f47e66269ff0cad30a8dad6f26 to your computer and use it in GitHub Desktop.
Save jonaslejon/b57021f47e66269ff0cad30a8dad6f26 to your computer and use it in GitHub Desktop.
WPSec.com PHP API
<?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