I normally play with web design in my spare time, and don’t normally deal with APIs so I figured this could be good for me. Unfortunately I tripped over the first hurdle. I wrote a very short script just to make sure that I was actually doing this right, and I managed to hit a 401 error. Any help is appreciated, thanks!
> 2533274792173269;2:
> You seem to be missing this line
>
>
> > $request->setHeader($headers);
>
>
> before your try/catch block so your API key is never sent. Also make sure you replace {player} in the URL with a Gamertag
Thanks for the reply (didn’t even realize I forgot to include that), but it didn’t seem to work. I still hit the 401 error.
> 2533274877535909;3:
> > 2533274792173269;2:
> > You seem to be missing this line
> >
> >
> > > $request->setHeader($headers);
> >
> >
> > before your try/catch block so your API key is never sent. Also make sure you replace {player} in the URL with a Gamertag
>
>
> Thanks for the reply (didn’t even realize I forgot to include that), but it didn’t seem to work. I still hit the 401 error.
Seems to be working on my end so not sure what’s causing that. Could you try this: spartan.php · GitHub
Made a few slight changes so it should result in the URL to your Spartan image. If you get any SSL errors, you’ll need a cacert.pem file (from here: http://curl.haxx.se/docs/caextract.html) and drop that into the same directory as the .php file.