Having a little problem with an API that's out there and before I admit that it's broken and i'm not - figured someone might see what i'm doing wrong.
This is what they are asking for as part of the url - a signature that is formed by this: hex-encoded MD5(key + secret + timestamp)
And this is what i'm giving them that's failing:
$key = 'xxxxxxxxxxxxxxxxxx';
$secret = 'DeMxxxxxxxxxw';
$timestamped = $_SERVER['REQUEST_TIME'];
$signature = md5($key + $secret + $timestamped);
So am I doing something wrong or are they not playing with me well?
Maybe you want to use .
(concatenation) instead of +
(sum)
$signature = md5($key . $secret . $timestamped);
I think you mean to concatenate the strings with .
instead of add numerically with +
.
$signature = md5($key . $secret . $timestamped);
PHP中的串联运算符为“。”,而不是“ +”
Do you really want to add these together or to you want to concatenate them?
// Adding
$signature = md5($key + $secret + $timestamped);
// Concatenating
$signature = md5($key . $secret . $timestamped);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.