Any software can use API functionality. We can provide full code in a form of WordPress plugin which can be used as staring base for further implementation.
This is a sample usage on a licence key activation call:
The first part of the code consist of few constants definition which are being used later within the code.
//the url where the WooCommerce Software License plugin is being installed define('SL_APP_API_URL', 'http://YourDomainWhereSoftwareManagement.com/index.php'); //the Software Unique ID as defined within product admin page define('SL_PRODUCT_ID', 'APTO'); $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; define('SL_INSTANCE', str_replace($protocol, "", get_bloginfo('wpurl')));
A simple activation calls will looks like this:
$args = array( 'woo_sl_action' => 'activate', 'licence_key' => $license_key, 'product_unique_id' => SL_PRODUCT_ID, 'domain' => SL_INSTANCE ); $request_uri = SL_APP_API_URL . '?' . http_build_query( $args ); $data = wp_remote_get( $request_uri ); if(is_wp_error( $data ) || $data['response']['code'] != 200) { //there was a problem establishing a connection to the API server } $data_body = json_decode($data['body']); if(isset($data_body->status)) { if($data_body->status == 'success' && $data_body->status_code == 's200') { //the license is active and the software is active //doing further actions like saving the license and allow the plugin to run } else { //there was a problem activating the license } } else { //there was a problem establishing a connection to the API server }