Skip to content

Instantly share code, notes, and snippets.

@lkLeonov
Last active December 11, 2016 09:37
Show Gist options
  • Save lkLeonov/b891fa8d157b6d62ff625723c8684f27 to your computer and use it in GitHub Desktop.
Save lkLeonov/b891fa8d157b6d62ff625723c8684f27 to your computer and use it in GitHub Desktop.
function getPublics(userId,callback) {
var xhr = new XMLHttpRequest();
var body = 'act=load_idols&al=1&oid=' + userId;
xhr.open("POST", 'https://vk.com/al_fans.php', true)
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
callback(this.responseText)
}
};
xhr.send(body);
}
getPublics(1, (data) => console.log(JSON.parse( data.substr(data.indexOf('<!json>') + 7))) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment