PHP script which works with Twitter Stream works on Mac, but not Linux


#1

I’ve wrote the script whic listen to the Twitter Stream.
It works fine on Mac dev machine, but refuses to work on Linux.

I run it and gets: HTTP/1.1 401 Unauthorized.

Could you please advise me what to do?
The source code is in the attachment:

Signature base string:

POST&https%3A%2F%2Fstream.twitter.com%2F1.1%2Fstatuses%2Ffilter.json&oauth_consumer_key%3D6D4eCG7bB4FKnNHtiwfEQ%26oauth_nonce%3Da23d761b65e610063d196bac224b54a0%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1381545820%26oauth_token%3D194489998-HKQHRdx14O7nv6OjPfcuqrkFCCfCTxz6rgjiuLGv%26oauth_version%3D1.0

The Request:

POST /1.1/statuses/filter.json HTTP/1.1
Host: stream.twitter.com
Authorization: OAuth oauth_consumer_key=“6D4eCG7bB4FKnNHtiwfEQ”, oauth_nonce=“4dcb034a5e11d915b5176ec93b033cb1”, oauth_signature=“5DFz7KFO5OsEqF1QtxzmQXSvcf8%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1381546083”, oauth_token=“194489998-HKQHRdx14O7nv6OjPfcuqrkFCCfCTxz6rgjiuLGv”, oauth_version="1.0"
Content-Length: 54
Content-Type: application/x-www-form-urlencoded

locations=82.851186%2C54.978717%2C83.00299%2C55.059965


#2

Hello Karmakov,

Apologies for the late reply on this topic. Have you managed to solve your issue?

When you encounter such 401 errors, please always make sure the time on your system is correct. The system clock is used by the OAuth implementation and needs to be in sync with the Twitter servers. You can check the current time in the “Date” HTTP header returned with every request.

Read more about Troubleshooting OAuth 1.0A at https://dev.twitter.com/discussions/204 and please let us know if that fixes your issues.