I am trying to utilize the GoodRx API using PHP.
Here is my code:
$hash = hash_hmac('sha256', $query_string, MY_SECRET_KEY);
$encoded = base64_encode($hash);
$private_key = str_replace('+', '_', $encoded);
$private_key = str_replace('/', '_', $encoded);
//$private_key = urlencode($private_key);
$query_string .= '&sig=' . $private_key;
echo $query_string;
// https://api.goodrx.com/low-price?name=Lipitor&api_key=MY_API_KEY&sig=MY_SECRET_KEY
It is returning an error saying that my sig is not right.
Could you help me please.
Thank you.
Thomas.