Here is what I’m trying to do (nothing complex):
use Digest::MD5 qw(md5 md5_hex md5_base64);
$apikey = '1234';
$secret = '123';
$timestamp = gmdate('U');
$sig = md5($apikey . $secret . $timestamp);
echo $sig
So, the error occurs on the $timestamp = gmdate line.
What am I doing wrong?
I think you are looking for the
gmtimefunction, not thegmdatefunction. Although, now that I see that you are passing'U'into it, I am confused.Ah, I see now, PHP uses
gmdate('U')the same way Perl 5 usesgmtime().Whoops, my memory failed, you need to use
Time::LocalorPOSIX::mktimeto turn the result oflocaltimeorgmtimeinto the epoch seconds.