Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8148241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:36:38+00:00 2026-06-06T14:36:38+00:00

I am writing a script to talk with twitter – everything seems fine apart

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:36:38+00:00Added an answer on June 6, 2026 at 2:36 pm

    You have a misunderstanding of Base64.

    Base64 takes an array of bytes of any value (0-255) and encodes those bytes into a printable data string, using the digits 0-9, A-Z, a-z, and + and / .

    Just as base10 uses the digits 0-9, and base2 uses 0 and 1, base64 uses characters from the alphabet to represent numeric digits. An A in base64 is not the same as an a. Therefore your use of strtolower() on a base64-encoded string is not going to yield any joy.

    ok. now back to twitter, they say the result is:

    B6 79 C0 AF 18 F4 E9 C5 87 AB 8E 20 0A CD 4E 48 A9 3F 8C B6
    

    Those are hex digits. That is not a base64-encoded value. If you base64 it, you will get something else (more data to follow).

    If you put that into a string, and try to base64 encode the string, you will once again fail. Twitter is not saying “this is the string you should get.” It’s saying, this is the byte array you should get.

    Furshtay?


    This code

    $p = pack("C*", 0xB6, 0x79, 0xC0, 0xAF, 0x18, 0xF4, 0xE9, 0xC5, 0x87,
              0xAB, 0x8E, 0x20, 0x0A, 0xCD, 0x4E, 0x48, 0xA9, 0x3F, 0x8C, 0xB6);
    $b64 = base64_encode($p);
    echo "base64: " . $b64 . "\n";
    

    yields:

    base64: tnnArxj06cWHq44gCs1OSKk/jLY=
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a script in PHP to get data from the twitter API,
im writing a script to get services from local and remote machines. I've had
I'm writing a script, and it requires to get a reCAPTCHA challenge with a
I am currently writing a script which parses the ServiceTage, Computername and Username from
I am writing a script that will transfer a file from one server to
I am writing a script to get the details of all the scheduled tasks
I am writing a python script that parses a 3D model file from one
I'm currently writing an msbuild script to publish a solution, which is all fine
I'm writing a script in Python that saves attachments from Gmail, only from unseen
I am writing a script at the moment that will grab certain information from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.