Skip to content

Instantly share code, notes, and snippets.

@DerexScript
Created September 7, 2017 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerexScript/756704fd0381d26797f00fd118e2ca00 to your computer and use it in GitHub Desktop.
Save DerexScript/756704fd0381d26797f00fd118e2ca00 to your computer and use it in GitHub Desktop.
let token = "MyTokenString";
let clantag = "#P8LJGY9V";
let client = new XMLHttpRequest();
let cors = 'https://cors-anywhere.herokuapp.com/';
client.open('get',cors+'https://api.clashofclans.com/v1/clans/'+encodeURIComponent(clantag),'true');
client.setRequestHeader('Authorization', 'Bearer '+token);
client.setRequestHeader('Accept', 'application/json');
client.onload = () => {
if(client.readyState==4 && client.status==200) {
console.log(client.responseText);
}else{
console.log(client.statusText);
}
};
client.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment