Skip to content

Instantly share code, notes, and snippets.

@ebinnion
Last active December 17, 2015 10:19
Show Gist options
  • Save ebinnion/5593813 to your computer and use it in GitHub Desktop.
Save ebinnion/5593813 to your computer and use it in GitHub Desktop.
Followerwonk Social Authority API Code Example
<?php
// Not currently working.
// Example Output
/*
https://api.followerwonk.com/social-authority?screen_name=randfish;AccessID=member-NTFhMjQxOTQtYTcwNi01YzI4LTk0OTYtZDZlY mRlYzJiMjVk;Timestamp=1368728186;Signature=S97mqDTS0qngjKR41hPhdO4BHpE%3D
"401 Unauthorized"
*/
$uri = 'https://api.followerwonk.com/social-authority';
$accessID = 'member-NTFhMjQxOTQtYTcwNi01YzI4LTk0OTYtZDZlYmRlYzJiMjVk';
$secretKey = 'fpndlhefzzsugpfcxvadtkdoqwaiwyly';
$time = time() + 500;
$signature = urlencode(base64_encode(hash_hmac("sha1", "{$accessID}\n{$secretKey}", $secretKey, true)));
$auth = "AccessID={$accessID};Timestamp={$time};Signature={$signature}";
echo "{$uri}?screen_name=randfish;{$auth}<br><br>";
$response = json_encode(file_get_contents("{$uri}?screen_name=randfish;{$auth}"));
print_r($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment