Skip to content

Instantly share code, notes, and snippets.

@scumola
Last active August 29, 2015 14:10
Show Gist options
  • Save scumola/56754ce473f3f4521ed2 to your computer and use it in GitHub Desktop.
Save scumola/56754ce473f3f4521ed2 to your computer and use it in GitHub Desktop.
perk points grabber - replace ACCESS_TOKEN AND USERID with your info
#!/usr/bin/php
<?php
$access_token = 'ACCESS_TOKEN';
$url = "https://api.perk.com/api/usercurrencyinformation?user_id=USERID&access_token=$access_token&device_type=web_browser";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
$data = json_decode($data);
$points = $data->userperks->availableperks;
$tokens = $data->userperks->availabletokens;
print "points:$points tokens:$tokens\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment