Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $whiteList = array(
- 'codes-que-vous-creez-vous-même-si-besoin-1',
- 'codes-que-vous-creez-vous-même-si-besoin-2',
- );
- $blackList = array(
- 'codes-que-vous-souhaitez-bannir (si le mec a piraté votre plugin par ex)-1',
- 'codes-que-vous-souhaitez-bannir (si le mec a piraté votre plugin par ex)-2',
- );
- function verify_envato_purchase_code($code_to_verify)
- {
- global $whiteList, $blackList;
- // Whitelist
- if (in_array($code_to_verify, $whiteList)) {
- return array('verify-purchase' => array('buyer' => true));
- }
- // Blacklist
- if (in_array($code_to_verify, $blackList)) {
- return array();
- }
- $username = 'votre-username-envato';
- $api_key = 'votre-api-key-envato';
- // Open cURL channel
- $ch = curl_init();
- // Set cURL options
- $url = "http://marketplace.envato.com/api/edge/". $username ."/". $api_key ."/verify-purchase:". $code_to_verify .".json";
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, 'API');
- $return = curl_exec($ch);
- $output = json_decode($return, true);
- curl_close($ch);
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement