Last active
January 6, 2018 13:49
-
-
Save polevaultweb/a7e09aa7d5331ac1e3af to your computer and use it in GitHub Desktop.
Activate Sellwire License
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 | |
| $sellwire_url = 'https://app.sellwire.net/api/1/'; | |
| $api_params = array( | |
| 'license' => $license, | |
| 'file' => $file_id | |
| ); | |
| $response = wp_remote_get( add_query_arg( $api_params, $sellwire_url . 'activate_license' ), $this->license_args() ); | |
| if ( is_wp_error( $response ) ) { | |
| $ajax_response['error'] = true; | |
| $ajax_response['message'] = $response->get_error_message(); | |
| } else { | |
| $license_data = json_decode( wp_remote_retrieve_body( $response ) ); | |
| if ( isset( $license_data->license ) ) { | |
| $options['license-status'] = $license_data->license; | |
| $ajax_response['license_status'] = $license_data->license; | |
| } else { | |
| if ( isset( $license_data->error ) ) { | |
| $ajax_response['error'] = true; | |
| $ajax_response['message'] = $license_data->error; | |
| } | |
| } | |
| } | |
| update_option( 'your_settings', $options ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment