This code helped me understand the OAuth flow and it written in PHP
with no libraries. https://github.com/joechung/oauth_twitter
See the authors blog post about it here 
http://nullinfo.wordpress.com/oauth-twitter/

On Mar 10, 5:55 am, Tudor Claudiu Florea
<tudor.claudiu.flo...@gmail.com> wrote:
> Hello,
> I am trying to build an application for twitter and in order to do
> that i need to build functions that post all requests to twitter only
> with pure PHP. no OAuth libraries or other user build libraries.
>
> problem is i always get the 401 unauthorized header.
> I have done twitter tutorial about this with theyr values(keys) and
> got same signature base and signature and everything else but when i
> input my data(secret key and stuff) all i get is 401 unauthorized
>
> This is a sample of my sent/received headers
>
> POST /oauth/request_token HTTP/1.1
> Host:api.twitter.com:443
> Content-Type: application/x-www-form-urlencoded
> Authorization:OAuth oauth_callback="http%3A%2F%2Fadme.ro
> %2Ftwitter_request.php",oauth_consumer_key="xxx..xxx",oauth_nonce="12997527 
> 12",oauth_signature_method="HMAC-
> SHA1",oauth_timestamp="1299752712",oauth_version="1.0",signature="Mv2IRkcgC 
> p3BNocBKFq8FJNN1OE
> %3D"
>
> HTTP/1.1 401 Unauthorized
> Date: Thu, 10 Mar 2011 10:25:18 GMT
> Server: hi
> Status: 401 Unauthorized
> X-Transaction: 1299752718-94070-29343
> Last-Modified: Thu, 10 Mar 2011 10:25:18 GMT
> X-Runtime: 0.00653
> Content-Type: text/html; charset=utf-8
> Content-Length: 44
> Pragma: no-cache
> X-Revision: DEV
> Expires: Tue, 31 Mar 1981 05:00:00 GMT
> Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-
> check=0
> Set-Cookie: k=93.114.42.59.1299752718223070; path=/; expires=Thu, 17-
> Mar-11 10:25:18 GMT; domain=.twitter.com
> Set-Cookie: guest_id=129975271823092185; path=/; expires=Sat, 09 Apr
> 2011 10:25:18 GMT
> Set-Cookie:
> _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCJePTJ8uAToHaWQiJTYwOGViZTRmYjYzY2Rm
> %250AYTI5NjM3NDRmZTNkODIwODg3IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy
> %250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--
> c237f0c52f06bd5e58f547db67136857e092fa2f; domain=.twitter.com; path=/;
> HttpOnly
> Vary: Accept-Encoding
> Connection: close
>
> Failed to validate oauth signature and token
>
> Can someone help me with this? i ran out of ideeas ...

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to