Skip to content

Instantly share code, notes, and snippets.

@hiddenpearls
Created June 19, 2018 14:23
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 hiddenpearls/bf05ec1a17f2270136eadb775f09b1c0 to your computer and use it in GitHub Desktop.
Save hiddenpearls/bf05ec1a17f2270136eadb775f09b1c0 to your computer and use it in GitHub Desktop.
Check EDD License status
/**
* Check and get the license data.
*
* @param string $license The license key.
*
* @return false|array
*/
public static function check_license( $license ) {
$license = trim( $license );
$api_params = array(
'edd_action' => 'check_license',
'license' => $license,
'item_id' => LOGINPRESS_PRODUCT_ID,
'url' => home_url()
);
// Call the custom API.
$response = wp_remote_post( self::LOGINPRESS_SITE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return false;
}
return json_decode( wp_remote_retrieve_body( $response ), true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment