We are developing a web application that use Twitter API with the library Phirehose. The code works on our computers (tested on Windows and a Debian virtual machine) and on the production server but not on the development server…
The configuration of Apache and php is the same on the development server and the virtual machine but we get a 401 Unauthorized error on the server: Problem accessing ‘/1.1/statuses/filter.json’. Reason:
Phirehose: Connecting to twitter stream: https://stream.twitter.com/1.1/statuses/filter.json with params: array ( ‘track’ => ‘food,lol’,)
Phirehose: Resolved host stream.twitter.com to 22.214.171.124, 126.96.36.199
Phirehose: Connecting to ssl://188.8.131.52, port=443, connectTimeout=5
Phirehose: Connection established to 184.108.40.206
Phirehose: POST /1.1/statuses/filter.json HTTP/1.1\r\nHost: stream.twitter.com:443\r\nConnection: Close\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: 16\r\nAccept: /\r\nAuthorization: OAuth realm="",oauth_consumer_key=“kU6J3mg5wA2RSh4gjAx9Q”,oauth_nonce=“994c34a8b12f886a673fc9e29a399452”,oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“1389346771”,oauth_version=“1.0A”,oauth_token=“1931074909-e4qbqNXSBwzFH4NQYDMLd1zTcbiuEdxk9J3wr6V”,oauth_signature=“22MMnIo5iklZViF1%2BMlNG6%2Bs7rc%3D”\r\nUser-Agent: Phirehose/1.0RC +https://github.com/fennb/phirehose\r\n\r\ntrack=food%2Clol\r\n\r\n
Phirehose: HTTP failure 1 of 20 connecting to stream: HTTP ERROR 401: Unauthorized (e92a2dd9c7ea5d79789f9806cfa4c7c35a3f65496fdb938fa6d0e8c5996f3354107Error 401 Unauthorized
HTTP ERROR: 401
Unauthorized). Sleeping for 10 seconds.
Problem accessing ‘/1.1/statuses/filter.json’. Reason:
We have this issue since a least a month but until a week ago it was only on a sub-domain and all was working just fine on another sub-domain on the same server…
This is not a problem of date since the two servers are sync on the same ntp server (I have check manually: they have the same time).
We use different credentials depending on where the code run but we successfully tried the development credentials on our computers and I have change the development credentials about one hour ago without any amelioration on the server.
Does someone have an idea?