Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ravelry API signing example php
<?php
// Shh keep this secret:
$secret = '1111111111111111111111111111111111111111';
$data = array();
$data['access_key'] = '00000000000000000000';
$data['query'] = 'yarn me'; // for example
$data['shop_type_id'] = '1'; // for example
$data['timestamp'] = date('c'); // ISO8601 format
$string = 'http://api.ravelry.com' . '/shops/search.json?' . http_build_query($data);
$signature = base64_encode(hash_hmac('sha256', $string, $secret));
$data['signature'] = $signature;
$final = http_build_query($data);
$final = 'http://api.ravelry.com' . '/shops/search.json?' . $final;
echo '<pre>' . $final . '</pre>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment