I am writing a script to talk with twitter - everything seems fine apart from generating a correct signature, where I get an access error. However, changing my variables to match those on the twitter documentation comes up with a different result. At the bottom of https://dev.twitter.com/docs/auth/creating-signature, it says:
For example, the output given the base string and signing key
given on this page is
B6 79 C0 AF 18 F4 E9 C5 87 AB 8E 20 0A CD 4E 48 A9 3F 8C B6
My code produces almost the same thing - just no spaces and lowercase. However when I base64_encode() it, I don't get the same value as in the documentation (tnnArxj06cWHq44gCs1OSKk/jLY=), even trying with different case/spacing/etc:
echo base64_encode('B679C0AF18F4E9C587AB8E200ACD4E48A93F8CB6');
echo strtolower(base64_encode('B679C0AF18F4E9C587AB8E200ACD4E48A93F8CB6'));
echo base64_encode('B6 79 C0 AF 18 F4 E9 C5 87 AB 8E 20 0A CD 4E 48 A9 3F 8C B6');
echo base64_encode(strtolower('B6 79 C0 AF 18 F4 E9 C5 87 AB 8E 20 0A CD 4E 48 A9 3F 8C B6'));
Resulting:
QjY3OUMwQUYxOEY0RTlDNTg3QUI4RTIwMEFDRDRFNDhBOTNGOENCNg==
qjy3oumwquyxoey0rtldntg3qui4rtiwmefdrdrfndhbotngoencng==
QjYgNzkgQzAgQUYgMTggRjQgRTkgQzUgODcgQUIgOEUgMjAgMEEgQ0QgNEUgNDggQTkgM0YgOEMgQjY=
YjYgNzkgYzAgYWYgMTggZjQgZTkgYzUgODcgYWIgOGUgMjAgMGEgY2QgNGUgNDggYTkgM2YgOGMgYjY=
Am I missing something obvious here?