Market API 403 Forbidden?


#1

I am trying to use the Envato API to check a purchase code, but I get a 403 forbidden response.

The auth is done with the Personal Auth Token option.

Here is my PHP code:

<?php
    $url = 'https://api.envato.com/v3/market/buyer/purchase?code=THE_PURCHASE_CODE';

    $opts = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Authorization: Bearer MY_AUTH_TOKEN\r\n"
      )
    );

    $context = stream_context_create($opts);

    // Open the file using the HTTP headers set above
    $file = file_get_contents($url, false, $context);
?>

Error: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden