REST API v1.1 with PHP



Hi Guys,

Im trying to read a twitter feed through a PHP code. I am using my twitter account to read the tweets of another account which is public like Intel/IBM/ and other tech companies. I have created my application and im following the steps outlined in the following URL: Im getting through till step 2 however at step 3 where im sending the recieved bearer token to read the tweets of another user im getting Bad authentication 215 error. Please help.

I was trying not to use any other 3rd party library to implement the same and it looked like a straightforward approach.

I hope to read another persons tweet thats the documentation I should refer to? Please do let me know.

Let me know if you guys need more info.


Adding additional info:

Im testing the above code in XAMPP server with PHP enabled.


I’ve just done the same thing using Postman to test - retrieved an app-only auth bearer token, added that to the Authorization header of my request, and called the user timeline endpoint. Note that this will not work with the home timeline endpoint - that requires a user token.

Are you able to trace out the headers you are sending (please don’t paste the actual Bearer token in your answer).

Is the time on your host accurate? Oauth is time-dependent so clock drift can cause auth failures.