Hi, I don’t know if any one has come across this issue.
I am a researcher doing work in healthcare at a UK University.
We have been working with atom and json outputs using http://search.twitter.com/search.format.
As with the recent announcements of API V1.1, we wrote some PHP CURL code to do the twitter search for us using OAuth and https://api.twitter.com/1.1/search/tweets.json.
On running the php code, we are getting the error “Could not authenticate you”.
Whilst we ran other calls e.g https://api.twitter.com/1.1/statuses/home_timeline.json all seem to be working fine.
Would some one tell me if I am missing something here?
Can I continue to use the http://search.twitter.com/search.format endpoint?
Many thanks is advance.


I am having same issue?


Perhaps there’s an encoding error in your query string for the search context? Can you share your signature base string or query string for a little debugging?


This is my query string:


My Authorization header is generated at 11:28 PM 10/9/2012 GMT:

Authorization: OAuth realm=“Twitter API”,oauth_consumer_key=“TgC0JrUEKNdnfeDlpp1Ww”,oauth_nonce=“4D048AEC”,oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“1349738903”,oauth_token=“321368584-2gAtKcrWZwejAyZIGjUq2Y9V1lo67HgnqbAlLyKw”,oauth_version=“1.0”,oauth_signature=“LP8W3WvHQt8Vda4GddBQ%2BYGASTQ%3D”


In this case, check the encoding on that @ symbol, which isn’t a valid character for this part of a URL – you want to use “%40” instead…


it did not work for “%40” … however, when i removed the “%40” completely the request went fine.

Is there something else that I need to encode beside the “@”


I would look deeper into your OAuth code and see specifically what it’s trying to do with the signature base string and the usage of these characters.


Thanks for your quick response…

I have 2 cases:

Case 1: Not Working



Case 2: Working


Thank you,


Case 1: It looks like you’re trying to issue a HTTP POST to this method – it’s a GET-based method. I also don’t recommend using since_id=0 but instead use an actual value or omit it entirely. You may also just be having conflicting HTTP methods (you’re performing a GET perhaps but your OAuth says its a POST)

Case 2: Your OAuth in this case is just being completely ignored as the search.twitter.com server doesn’t support OAuth.


I had the same problem.

I changed the “oAuth::getOAuthHeader” function.

  • buildOAuthRawDataKeyValPairs( dataPart, true, rawKeyValuePairs );
  • buildOAuthRawDataKeyValPairs( dataPart, false, rawKeyValuePairs );

Now I don’t have any problems.


could anyone guide me about the coding in php how to use twitter search api.


There is a worst api documentation then Twitter API?