How to use API

Hey guys, I have some programming experience, but I am sort of new to APIs.

I am trying to get this request:
https://www.haloapi.com/profile/{title}/profiles/{player}/emblem[?size]

Down below is the cosde to use for PHP.

// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once ‘HTTP/Request2.php’;

$request = new Http_Request2(‘https://www.haloapi.com/profile/{title}/profiles/{player}/emblem’);
$url = $request->getUrl();

$headers = array(
// Request headers
‘Ocp-Apim-Subscription-Key’ => ‘{subscription key}’,
);

$request->setHeader($headers);

$parameters = array(
// Request parameters
‘size’ => ‘{number}’,
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}

?>

I filled in the header with this:
$request = new Http_Request2(‘https://www.haloapi.com/profile/{h5}/profiles/{itzhydrogen1}/emblem’);

WHICH WORKS

BUT I get this error message when I go to my page:
{ “statusCode”: 401, “message”: “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.” }

I know I am suppose to insert my Ocp-Apim-Subscription-Key into there, which I did, but its still giving me same error code.
I am inserting my Primary subscription key under “Your Subscriptions” in my profile page. Is this the wrong key or what?

Ok so I took out the {} braces for:

‘Ocp-Apim-Subscription-Key’ => ‘{subscription key}’,
like this
‘Ocp-Apim-Subscription-Key’ => ‘xxxxxxxxxxxxxxxxxxxxxxx’,

and it worked
but now it just show an empty page?

Never mind, I wasn’t suppose to take out the {}, so now i am back to original error

You don’t need the curly braces for the key, title, gamertag, size…etc as they just indicate where you put your parameters. Also, you’ll need to URL encode the gamertag (e.g. “iTz HydrogeN 1” becomes “iTz%20HydrogeN%201”).

Ok thank you, I will try that.